main=interact$map last.foldr(!)[] a!x|elem[a]x=x|l<-" v":x=max l$[a]:min(">":x)x
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page