FST · Rational transduction
Replace the last letter with x
A transducer reading left to right cannot know which letter is the last. This one guesses: on each letter it either copies it or bets that it is the last and writes x instead. Only the branch that bet correctly reaches the accepting state at the end, so exactly one output survives.
The author’s examples, run
a → accept · xb → accept · xaa → accept · axab → accept · axaaa → accept · aaxbbbbbabbaaabbaaa → accept · bbbbbabbaaabbaax