//
// Reverse the ordering of words in a String
// I have this string: "My name is X Y Z";
// and I want to reverse the order of the words so that: "Z Y X is name My"
using System;
public class Program
{
public static void Main()
string str = "My name is X Y Z";
reverseWords(str);
}
public static void reverseWords(string str){
string ans = "";
var res = str.Split(' ');
for(var i = res.Length-1; i >= 0; i--){
ans += res[i] + " ";
Console.WriteLine(ans);