public static void Main()
Console.WriteLine("Write in a sentence");
String Sentence = Console.ReadLine();
Sentence = Sentence.Replace(" ", " ");
Sentence = Sentence.Trim();
int Length = 0, Words = 1;
while (Length <= Sentence.Length - 1)
if (Sentence[Length] == ' ')
Console.WriteLine("The total number of words is: " + Words);