Similarity Expansion by recursive

import re
r=""
while 1:r=re.sub(' +" *',lambda m:r[m.start():m.end()],raw_input()+" "*99).strip();print r

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

download

return top