open Stream open List;;while 1=1do Scanf.scanf"%d %s@ "(fun i s->let b=map(fun e->[e])(npeek 99(of_string s))in let rec($)a?(s=Sort.list(<)a)(_::x)=x>[]&map2(@)b s$x||[]<map print_char(nth s i@[' '])in b$b)done
Note that non-ascii characters in the above source code will be escaped (such as \x9f).