A typing speed test loads up a dictionary of words, and gives you one to type: pinball
. You, with your fast but inaccurate fingers, type in pinbnal
. Darn it!
Make a program that will print out a random word from a dictionary, then ask for the user to type this word back, and finally return whether or not they got the word right. The catch is: the program must accept minor typos.
Accept a typo if it has only one of the following:
- one letter is repeated in the input 1 or 2 more times. Only accept the letter if it is directly adjacent to a letter it is next to.
- one letter in the word is repeated 1 time.
- 2-4 of the letters in the input are scrambled.
Some acceptable typos of the word pinball
are:
pingball pinbala pinbanll
Some unacceptable typos:
pibnannl maxwell pinbalgl
Shortest code wins. Good luck.
pinbala
orpinbnal
then? The secondl
is missing completely in both cases. \$\endgroup\$pingball
adds a new letter - it's fundamentally the same error aspinbalgl
. \$\endgroup\$dict/words
has some modifications ;) \$\endgroup\$