using System;
public class exercise100
{
public static int CountSpaces(string text)
{
int countSpaces = 0;
string letter;
for (int i = 0; i < text.Length; i++)
{
letter = text.Substring(i, 1);
if (letter == " ")
countSpaces++;
}
return countSpaces;
}
public static void Main()
{
Console.WriteLine("\"Hello, how are you\" contains {0} spaces",
CountSpaces("Hello, how are you"));
}
}