Show that for each string $w ∈ \{0, 1\}^∗$ there exists a stay-put Turing machine
$$M_w = (Q, \{0, 1\}, \Gamma, \delta, s, q_{\mathit{accept}}, q_{\mathit{reject}})$$
with $|Q| ≤ 5$ states that starts on a blank tape in state $s$ and ends in state $q_{\mathit{accept}}$ with the tape content $w$ beginning in the first cell and the head under that cell.
That is, starting on a blank tape, the machine outputs $w$ and stops in $q_{\mathit{accept}}$.
I know that if there were infinite states then we could put each letter into its own state so that we could print the letter when needed, but I don't know how to reduce it to 5 states.