Here is how I would go about doing this:
The current input is reset when it is no longer a substring of the correct input.