gets e=gets.split.map &:to_i d=[0,-1,0,1] c=[] while d.size<=e.size c<1&&e[-1]==0 p e.size-1 puts e*' '