how do i get rid of EOFError or NZEC ERROR??When i custom input i didn't get an error but if don't i get eof error!!!!!!!!!

from itertools import permutations

def words(letters):
for n in range(1, len(letters)+1):
yield from map(’’.join, permutations(letters, n))

#leng = int(input().strip())
#arr = int(input().strip())
leng = int(input())
arr = int(input())
#leng=2
#arr=4
#leng, arr = map(int, input().split())
s=""
i=0
while i<arr:
s1=input(’’)
s=s+s1
i=i+1

l=[]
for word in words(s):
if len(word)==leng:
l.append(word)

count=0
a=sorted(l)
for elements in a:
print(elements)
count=count+1
print(count)

When you run your program here, the computer gives some pre specified input. But when the input syntax of computer doesn’t match with your program input syntax it shows EOF error. For example, if in a programm,you made it to take 2 inputs one after other other, but the computer gives 2 inputs at once,the it’ll give the error. To avoid this error ,make program which takes exact input in same syntax as in example of input and output.

1 Like

Please mention what problem you are talking about… And please give your solution link too… :slight_smile:

T=int(input())
for y in range(T):
(n,k)=tuple(int(x) for x in input().split())
a=list(int(i) for i in input().split())
(task,l,j)=(0,1,1)
while True:
if l>len(a):
task=task
else:
task=task+a[l-1]
if task>=k:
j+=1
task-=k
else:
print(j)
break
l+=1

for the problem https://www.codechef.com/problems/CHEFEZQ