using System.Collections.Generic;
public static void Main()
Program.ReverseWords("Hello World");
public static void ReverseWords(string str)
StringBuilder output = new StringBuilder();
List<char> charlist = new List<char>();
for(int i = 0; i< str.Length; i++)
if (str[i] == ' ' || i == str.Length - 1)
for(int j = charlist.Count - 1; j >=0; j--)
output.Append(charlist[j]);
charlist = new List<char>();
Console.WriteLine(output.ToString());