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. From there, you can simply choose to cancel or confirm from the options.

If you find yourself activating this feature by accident, you can deactivate it from the Settings app by selecting GeneralAccessibilityShake to Undo, and turning off the toggle.