stable partition by

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

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

download

return top