main = interact f g 0=[""]g n|a<-g$n-1=map('0':)a++map('1':)(reverse a)d=dropWhilef s=d(=='0')$(d(/='0':s)$g$1+length s)!!1
101100
100100
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!