public static void Main()
Console.WriteLine("Enter a string:");
string input = Console.ReadLine();
string[] words = input.Split(' ');
foreach (string word in words)
if (word.Length > longestWord.Length)
Console.WriteLine("The longest word in the string is: " + longestWord);