DISCHAR python code, Not able to find a case where it fails

t = raw_input()

t = int(t)

a = []

for i in range(26):

	   a.append([0,0])
	
for i in range(t):

           cnt = 0
	   max_cnt = 0
	   start = 0
	   for i in range(26):
		   a[i] = [0,0]
	
	   s = raw_input()
	   for j in range(len(s)):
		   index = ord(s[j]) - 97
		   if(a[index][0] == 1):
			   pre_index = a[index][1]
			   for k in range(start,pre_index+1):
				   del_index = ord(s[k]) - 97
				   a[del_index][0] = 0
				   cnt = cnt - 1
			   a[index][0] = 1
			   a[index][1] = j
			   start = pre_index+1
			   cnt = cnt + 1
		   else:
			   a[index] = [1,j]
			   cnt = cnt + 1
			   if max_cnt < cnt:
				   max_cnt = cnt
				
	   print max_cnt

It seems like you did not get the question correctly. Read the last line in problem statement …

A subsequence of string A is a sequence that can be derived from A by deleting some elements and without changing the order of the remaining elements. 

Understand the difference between substring and subsequence.

You need to find the length of largest subsequence of given string with frequency of each character equal to 1.

Check for the cases …

3
abcbd
abcaadde
abaebbc

Output should be

4
5
4

my solution was:

t = int(raw_input())
while t:
   s = raw_input()
   print len(set(s))
   t -= 1

AC in 0.09s :stuck_out_tongue:

PS - read the problem again it says “SUBSEQUENCE” of given input