CSharp - Write program to check the input string length

Requirements

You will write a program that evaluates whether the entered text is at most four characters long.

Hint

You can determine the number of characters of text-using its Length property.

You can use the less-than-or-equal-to operator <=

Demo

using System;
class Program/*from  w w  w  .  j  av a  2  s  . c o m*/
{
    static void Main(string[] args)
    {
        // Input 
        Console.Write("Enter a word: ");
        string word = Console.ReadLine();

        // Determining length 
        int wordLength = word.Length;

        // Checking length 
        if (wordLength <= 4)
        {
            Console.WriteLine("Word is short (at most 4 characters)");
        }
        else
        {
            Console.WriteLine("Word is long (more than 4 characters)");
        }
    }
}

Result