Ejemplo n.º 1
0
        public IActionResult AnagramCheck([FromBody] Words words)
        {
            ITwoWordChecker anagramChecker = new TwoAnagramChecker();

            if (anagramChecker.checkTwoWords(words.W1, words.W2))
            {
                return(Ok(words.W1 + " and " + words.W2 + " are anagrams"));
            }
            return(BadRequest(words.W1 + " and " + words.W2 + " are no anagrams"));
        }
Ejemplo n.º 2
0
        static void CheckForAnagram(IEnumerable <string> words)
        {
            if (words.Count() < 2)
            {
                Console.WriteLine("CHECK: two words are required for anagram comparison");
                return;
            }
            string          w1             = words.ElementAt(0);
            string          w2             = words.ElementAt(1);
            ITwoWordChecker twoWordChecker = new TwoAnagramChecker();

            if (twoWordChecker.checkTwoWords(w1, w2))
            {
                Console.WriteLine(w1 + " and " + w2 + " are anagrams");
            }
            else
            {
                Console.WriteLine(w1 + " and " + w2 + " are no anagrams");
            }
        }