+ 3
I don't know why this code doen't solve the 2nd test case.Can anyone find the bug,please
deja Vu solution bug https://code.sololearn.com/cLaqw7KRzaHF/?ref=app
3 Antworten
+ 1
text = input()
d = dict.fromkeys(text, 0)
print(d)
for c in text:
d[c] += 1
print(d)
if any(i>1 for i in d.values()):
print("Deja Vu")
else:
print("Unique")
In your solution a=d[c] is storing value of the last character which can have a value greater than 1 or not ,if it doesn't have value greater than 1 then it will output unique even if other characters before it are repeated
+ 3
Abhay thanks for helping
I understood what was the bug in my solution
+ 2
Arrahman Abtahi your code will only work if the last character of the string is repeated because you are checking that only.