public static void Main()
var s = Console.ReadLine();
var result = c.ReverseWords();
(new string(result)).Dump();
static class CharArrayHelpers
public static char[] ReverseChars(this char[] @this, long from = -1, long to = -1)
from = from > -1 ? from : 0;
to = to > -1 ? to : @this.Length - 1;
var middle = (to + from) / 2;
for (var ix = from; ix <= middle; ix++)
@this[ix] = @this[to - ix + from];
@this[to - ix + from] = tmp;
public static char[] ReverseWords(this char[] @this)
while (ix < @this.Length)
while (ix < @this.Length && @this[ix] != ' ')
@this.ReverseChars(from, to);