character subsets by kt3k

n=b='\n'
for i in raw_input()[::-1]:b+=b.replace(n,n+i)*-~-(i in b)
print b[1:]

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

download

return top