%% The TM is given an input
%% of the form of a regular expression sa*ma*e, e.g.
%% saaamaae
%% It halts with placing n1*n2 a's after e, where
%% n1 is the number of a's between s and m and
%% n2 is the number of a's between m and e.
%%
start_state(1).
delta(1,2,s,s,r).
delta(2,3,a,x,r).
delta(2,11,m,m,l).
delta(3,3,a,a,r).
delta(3,4,m,m,r).
delta(4,5,a,x,r).
delta(4,9,e,e,l).
delta(5,5,a,a,r).
delta(5,6,e,e,r).
delta(6,6,a,a,r).
delta(6,7,#,a,l).
delta(7,7,a,a,l).
delta(7,8,e,e,l).
delta(8,8,a,a,l).
delta(8,4,x,x,r).
delta(9,9,x,a,l).
delta(9,10,m,m,l).
delta(10,10,a,a,l).
delta(10,2,x,x,r).
delta(11,11,x,a,l).
delta(11,h,s,s,r).