diff --git a/Program.cs b/Program.cs index 3751555..a56ce0e 100644 --- a/Program.cs +++ b/Program.cs @@ -1,2 +1,24 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +class Program { + static void Main() { + // get all the words form the text file and put them into a hasset + var words = new List(File.ReadAllLines("input.txt")); + var wordSet = new HashSet(words); + + // Find all combos that forn a 6 letter word and make sure we dont have duplicates + var seenCombinations = new HashSet(); + var combos = words.SelectMany( + word1 => words.Where(word2 => word1 != word2), + (word1, word2) => new { word1, word2, combinedWord = word1 + word2 } + ).Where( + x => x.combinedWord.Length == 6 && wordSet.Contains(x.combinedWord) + ).Where( + x => seenCombinations.Add($"{x.word1}+{x.word2}") + ).Select( + x => $"{x.word1}+{x.word2}={x.combinedWord}" + ).ToList(); + + // echo out all found words + combos.ForEach(Console.WriteLine); + + } +} diff --git a/bin/Debug/net8.0/6letterwordexercise.dll b/bin/Debug/net8.0/6letterwordexercise.dll index 4686d64..1a70504 100644 Binary files a/bin/Debug/net8.0/6letterwordexercise.dll and b/bin/Debug/net8.0/6letterwordexercise.dll differ diff --git a/bin/Debug/net8.0/6letterwordexercise.pdb b/bin/Debug/net8.0/6letterwordexercise.pdb index 726db3c..3179971 100644 Binary files a/bin/Debug/net8.0/6letterwordexercise.pdb and b/bin/Debug/net8.0/6letterwordexercise.pdb differ diff --git a/obj/Debug/net8.0/6letterwordexercise.AssemblyInfo.cs b/obj/Debug/net8.0/6letterwordexercise.AssemblyInfo.cs index c4a231a..87ce2d2 100644 --- a/obj/Debug/net8.0/6letterwordexercise.AssemblyInfo.cs +++ b/obj/Debug/net8.0/6letterwordexercise.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("6letterwordexercise")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2ee45d0c33abdc2258987bbae591edb100ebb81b")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7a30bacb68910559e2c2bc33337d57c1364a1b60")] [assembly: System.Reflection.AssemblyProductAttribute("6letterwordexercise")] [assembly: System.Reflection.AssemblyTitleAttribute("6letterwordexercise")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/obj/Debug/net8.0/6letterwordexercise.AssemblyInfoInputs.cache b/obj/Debug/net8.0/6letterwordexercise.AssemblyInfoInputs.cache index 34fcf52..0fa7ea7 100644 --- a/obj/Debug/net8.0/6letterwordexercise.AssemblyInfoInputs.cache +++ b/obj/Debug/net8.0/6letterwordexercise.AssemblyInfoInputs.cache @@ -1 +1 @@ -11bb087ea0f446bb0d874c8a6517161613518f7e65c34da03edbfc9d8b21c232 +38d39cd6b0bba17b8e33dc8144efa9e3646f6745189f6a226aa41ca2ccf216ba diff --git a/obj/Debug/net8.0/6letterwordexercise.dll b/obj/Debug/net8.0/6letterwordexercise.dll index 4686d64..1a70504 100644 Binary files a/obj/Debug/net8.0/6letterwordexercise.dll and b/obj/Debug/net8.0/6letterwordexercise.dll differ diff --git a/obj/Debug/net8.0/6letterwordexercise.pdb b/obj/Debug/net8.0/6letterwordexercise.pdb index 726db3c..3179971 100644 Binary files a/obj/Debug/net8.0/6letterwordexercise.pdb and b/obj/Debug/net8.0/6letterwordexercise.pdb differ diff --git a/obj/Debug/net8.0/ref/6letterwordexercise.dll b/obj/Debug/net8.0/ref/6letterwordexercise.dll index 5b456f9..0aebd4d 100644 Binary files a/obj/Debug/net8.0/ref/6letterwordexercise.dll and b/obj/Debug/net8.0/ref/6letterwordexercise.dll differ diff --git a/obj/Debug/net8.0/refint/6letterwordexercise.dll b/obj/Debug/net8.0/refint/6letterwordexercise.dll index 5b456f9..0aebd4d 100644 Binary files a/obj/Debug/net8.0/refint/6letterwordexercise.dll and b/obj/Debug/net8.0/refint/6letterwordexercise.dll differ