fork(1) download
  1. main = interact f
  2.  
  3. g 0=[""]
  4. g n|a<-g$n-1=map('0':)a++map('1':)(reverse a)
  5. f s=d(=='0')$(d(/='0':s)$g$1+length s)!!1
Success #stdin #stdout 0s 4724KB
stdin
101100
stdout
100100