4/5 test cases have passed...1 hidden test case not passed...can someone help me?..what might that case be?..whats wrong here? | Sololearn: Learn to code for FREE!

0

4/5 test cases have passed...1 hidden test case not passed...can someone help me?..what might that case be?..whats wrong here?

Input Format: A string of random letter characters (no numbers or other buttons were pressed). Output Format: A string that says 'Deja Vu' if any letter is repeated in the input string, or a string that says 'Unique' if there are no repeats. Sample Input: aaaaaaaghhhhjkll Sample Output: Deja Vu Explanation: Your program should output 'Deja Vu' because there are many repetitions in 'aaaaaaaghhhhjkll'. a = input() b = list(a) temp = [] con = False for i in b: if i in temp : print('Deja Vu') con = True else: temp.append(i) if con == False : print('Unique') else : pass

3/20/2020 7:51:50 AM

Chinmay Bhalerao

3 Answers

New Answer

+1

Chinmay Bhalerao This is the correct version of ur code. a = input() b = list(a) temp = [] con = False for i in b: if i in temp: con = True break else: temp.append(i) if con == False: print('Unique') else: print('Deja Vu')

+2

If repeated, print Deju Vu and exit loop.. Edit: For aaabc, It printing 2times Deja Vu. Need only one time.

+1

Chinmay Bhalerao text = input() if sorted(set(text)) == sorted(text): print("Unique") else: print("Deja Vu") This is an easy way. What set() does is that it removes any duplicates, so if after removing duplicates and before removing duplicates is the same, print unique, otherwise dejavu.