Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2025/ii/paper-3/4f/a/solution

The instruction goes to if register is empty; otherwise it deletes the final letter and goes to .
For , an empty input goes directly from to , where a is appended. On a nonempty input, state deletes every letter; once the register is empty it goes to and appends . Hence
For , the initial instruction tests whether the final letter is . If it is, state deletes the entire word and then goes to , producing . Otherwise state deletes the entire word and goes to , producing . Thus
the set of nonempty binary words ending in .

New to topics? Read the docs here!