String Halving by Hendrik

using C=System.Console;class X{static string H(string s){int x=s.Length;return(x>1)?"{"+H(s.Remove(++x/2))+H(s.Remove(0,x/2))+"}":"{"+s+"}";}static void Main(){C.Write(H(C.ReadLine()));}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page