+ 2

Deja Vu solution not quite working

I know there are other ways, but is this a viable way to solve the Deja Vu code coach problem? It currently isn't working. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { string input = Console.ReadLine(); string modInput = null; bool dejaBool = false; foreach (char c in input ) { char tempChar = c; modInput = input.Remove(input.IndexOf(c)); if (modInput.Contains(tempChar)) { dejaBool = true; } } if (dejaBool ==true) Console.WriteLine("Deja Vu"); else {Console.WriteLine ("Unique");} } } }

5th Mar 2020, 7:23 PM
Ryan
2 odpowiedzi
+ 2
That did it. Thank you!
5th Mar 2020, 8:16 PM
Ryan
+ 1
#hope it helps #python str1=input("") count={} str2=[2,3,4,5,6,7,8,9] for i in str1: if i in count: count[i]+=1 else: count[i]=1 val=count.values() set1=set(count.values()) if set1=={1}: print("Unique") else: for s in str2: if s in val: print("Deja Vu")
2nd May 2020, 4:48 PM
Bighnaraj Mallick
Bighnaraj Mallick - avatar