public static void CountWord() { Console.Clear(); Console.WriteLine("Welcome, please enter a sentence and a word to check the occurence of your word in your sentence."); Console.Write("Enter a sentence: "); string userSentence = Console.ReadLine().ToLower(); Console.Write("Enter a word: "); string userWord = Console.ReadLine().ToLower(); RepeatCounter newUserInput = new RepeatCounter(userWord, userSentence); if (RepeatCounter.CheckValidInput() == true) { Console.WriteLine($"Your word \"{userWord}\" appears {RepeatCounter.SearchWords()} times in your sentence."); } else { Console.WriteLine($"Your word \"{userWord}\" does not exist in your sentence \"{userSentence}\""); } }