capital and small letters by ditto

s=raw_input()
z=zip(s.upper(),s.lower())
r=[[]]
a=[[],[]]
for _ in s:r=[x+[y]for x in r for y in(0,1)]
for p in r:n=''.join([c[t]for c,t in zip(z,p)]);a[n<s]+=[n]
print'\n'.join(a[0]+a[1])

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

download

return to the top page