using System;
public class Program
{
public static void Main()
string str;
char sp = ' ';
int i, count;
count = 0;
Console.WriteLine("Please input a string: ");
str = Console.ReadLine();
for (i = 0; i < str.Length; i++)
if (str[i].Equals(sp))
count++;
}
Console.WriteLine("Number of spaces in the string is: " + count);