main=interact f f x=unlines[f$a++pred b:c|(a,b:c)<-[span(<'1')x]]++x