This is missing in typewriter2 !!!
Remark
You copied typewriter1 to typewriter2. I understand why. In general it’s better to write a more abstract version of the function and use it for both cases. Eg you could pass the String and what’s the next state as a parameter