When typing in any application, or when using cut, or copy and paste, you can shake the phone to undo your typing and shake again to redo.

Your phone will pop up a query to double check you meant to do this and then you can simply choose to cancel or confirm from the options.

shake-to-undo-and-redo