About Begineers Problem

I am a new to programming and Codechef I had done a beginning problem https://www.codechef.com/problems/LIKECS01
The program I wrote was on python 3.6 and it gave the result on my machine every time.
But when I submitted the code(there was the only option for py3.5 but I don’t think it is the reason)
my code was said to be wrong.

T = int(input("Enter Number of test cases:"))
for i in range(T):
	S = input()
	ans = 0
	for j in range(0,len(S),1):
		for k in range(j+1,len(S),1):
			if(S[j]==S[k]):
				ans = 1
	if(ans == 1):
		print ("yes")
	else:
		print("no")

This is my code, it finds if the string is subsequent or not.
Please let me know what is wrong with the code.

Print EXACTLY whats mentioned in output section. Printing any other superfluous statement will lead to WA. Remove statements like “Enter trst cases.”.

Thank you. I removed the Enter test case and it worked.

1 Like