Counting Number of Words in a String - C# Program
Anyone can suggest me the output of the following program.
using System;
class CountWords
{
public static void Main()
{
string s = ""; // Declare 's' of string type
Console.Write("Enter the string : ");
S = Console.ReadLine(); // Read string from the console & save in 's'
string [] words = s.Split(null);
// 'words' is an array of string type
// string 's' will split when a space (null) is encountered
// This will be saved into array words
int i = words.Length; // Just count the lenght of array 'words'
Console.WriteLine("The total number of words in the entered string : "+i);
Console.ReadLine();
}
}