This is the second part of the Turing Machine series. For your convenience you can find other parts in the table of contents in Part 1 – Addition

Today we check if given word w is of a form w = xx. Idea is: first I add delimiters ^ to the word boundary. Next, I use $ to cut one character at a time from the prefix and from the suffix of the word. Finally, I know where is the center of the word, so I can compare characters one by one.


The input looks like this:

Transition table: