using System;
public class Program
{
public static void Main()
String sentence = "Beauty lies in the eyes of beholder";
int wordCount = 0;
for(int i = 0; i < sentence.Length-1; i++) {
//Counts all the spaces present in the string
//It doesn't include the first space as it won't be considered as a word
if(sentence[i] == ' ' ) {
wordCount++;
}
//To count the last word present in the string, increment wordCount by 1
//Displays the total number of words present in the given string
Console.WriteLine("Total number of words in the given string: " + wordCount);