stable partition by SeeNoEvil

i=raw_input()
a=b=''
for c in i:
 if c<i[0]:a+=c
 elif c>i[0]:b+=c
 else:b=c+b
print a+b

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

download

return top