Esempio n. 1
0
        public KeyValuePair <string, int>[] ReadWordsWithFrequencyTest(string[] lines)
        {
            var input = new StringReader(String.Join(Environment.NewLine, lines));

            Console.SetIn(input);
            return(ReadHelper.ReadWordsWithFrequency().ToArray());
        }
Esempio n. 2
0
        private static void Main()
        {
            var words     = ReadHelper.ReadWordsWithFrequency();
            var userWords = ReadHelper.ReadUserWords();

            var trie = CreateTrie(words);

            foreach (var foundWords in userWords.Select(trie.FindFor).Where(foundWords => foundWords.Count() != 0))
            {
                foreach (var foundWord in foundWords)
                {
                    Console.WriteLine(foundWord);
                }
            }
            Console.ReadLine();
        }