gets ~/ / a=eval$' r=gets[a-1] c=1 p loop{(c+=r==$_[~-a+=81-r.ord*2]?1:-1)<1&&(break a)}