Turing Machine by kotauchi

t=["0"]*999\x0d
a={}\x0d
s=raw_input().replace(" ","")\x0d
for i in s:a[i]=[]\x0d
while 1:\x0d
 try:\x0d
  for i,v in enumerate(raw_input().split(" ")[2:]):a[s[i]].append(v)\x0d
 except:break\x0d
u=w=b=499\x0d
c="A"\x0d
while 1:\x0d
 v=a[c][int(t[b])];t[b]=v[0]\x0d
 if v[2]!="#":c=v[2]\x0d
 else:print "".join(t[u:w+1]);break\x0d
 if(v[1]=="<"):b-=1;u=min(u,b)\x0d
 else:b+=1;w=max(b,w)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top