NZEC - EOF error while submitting a solution

Hello everyone,
My code runs fine in an IDE on my laptop, it works fine when I provide custom input and run on codechef but gives NZEC while Submitting.
Problem : CHEFCHR
Where am I going wrong ?

t = int(input())

for _ in range(t):
	str = input()

	my_list = []
	for char in str:
		my_list.append(char)

	count=0
	a=0
	b=4
	while b!=(len(my_list)+1):
		my_dict = {'c':99,'h':99,'e':99,'f':99}
		for i in range(a,b):
			my_dict[my_list[i]]=1

		# print(my_dict)

		if my_dict['c']==1 and my_dict['h']==1 and my_dict['e']==1 and my_dict['f']==1:
			count+=1
		
		a+=1
		b+=1
	if count!=0:
		print("lovely",count)
	else:
		print("normal")

You should use

while b < (len(my_list)+1): instead of
while b != (len(my_list)+1):

Your program is failing for strings having length less than 4.
e.g. ch

1 Like

Thank you ! It worked :slight_smile: