def main():
n = int(input().strip())
a = list(map(int, input().rstrip().split()))
b = list(map(int, input().rstrip().split()))
a.sort()
b.sort()
total=0
i=0
j=0
while i!=len(a):
while j!=len(b):
# print('a[i]', a[i],'b[j]',b[j])
if a[i]<b[j]:
# print('in a[i]<b[j]')
i+=1
break
if a[i]==b[j]:
total+=1
i+=1
j+=1
# print('total is ',total)
break
else:
# print('in else')
j+=1
if total==n:
print(n)
else:
print(total+1)
main()
Input:
4
1 2 3 4
1 2 3 3
The program keeps asking for input even after i press the "enter" button on my keyboard. while for other types of input it works perfectly fine
aandb?python program.py < input.txtprintstatements to see what's going on when you run it.