4.9 Construct a Turing machine with one tape that receives as input a string of the form "1^n" for some integer n ∈ Z, where n is the number of 1's in the string. The output of the Turing machine is the string "1^nQ1^n". Thus, this Turing machine makes a copy of its input. The input alphabet is Σ = {1} and the tape alphabet is Γ = {1,0}.
Start of the computation: The tape contains a string of the form "1^n", where n ≥ 0. The tape head is on the leftmost symbol, and the Turing machine is in the start state. For example, if n = 4, the tape looks as follows:
[1] [1] [1] [1]
End of the computation: The tape contains the string "1^nQ1^n". The tape head is on the 0 in the middle of this string, and the Turing machine is in the final state. For our example, the tape looks as follows:
[1] [1] [1] [Q] [1] [1] [1]
The Turing machine in this exercise does not have an accept state or a reject state; instead, it has a final state. As soon as this state is entered, the Turing machine terminates. At termination, the contents of the tape are the output of the Turing machine.