static void Main(string[] args) { string myString = Console.ReadLine(); int count = 0; for (int i = 0; i < myString.Length; i++) { // check the char for whitespace. If char is not whitespace, increase the count variable if (!char.IsWhiteSpace(myString[i])) { count++; } } Console.WriteLine("Total letters: "+ count); Console.ReadLine(); }