Turing Machine by

import sys
r=list(sys.stdin)
p=500
t=['']*p*2
s='A'
while'#'<s:t[p],d,s=r[int(t[p]or 0)+1][ord(s)-64<<2:][:3];p+=ord(d)-61
print''.join(t)

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

download

return top