To each of these nine confusingly similar words, assign a number 1-9 in any way you like:
though
through
thorough
Thoreau
throw
threw
trough
tough
troll
Write a program that takes in a string. If the input is one of these nine words, output the number you assigned to it. If the input is not one of the words above, the program may do anything (including error or loop forever).
The words are case sensitive, e.g. Thoreau
, should produce a number from 1-9 but thoreau
will not necessarily do the same.
Example
Suppose you assign the numbers as follows:
though 9
through 2
thorough 7
Thoreau 6
throw 3
threw 5
trough 4
tough 1
troll 8
Then when tough
is input, 1
should be output.
When through
is input, 2
should be output.
When throw
is input, 3
should be output.
. . .
When though
is input, 9
should be output.
All other inputs may do anything.
Details
- Take the input string via stdin or the command line and output to stdout.
- The output may contain a single trailing newline.
- Instead of a program, you may write a function that takes in a string and prints the result normally or returns it.
- The shortest submission in bytes wins.
find
method. Then the rules changed. Clever idea not so clever now. \$\endgroup\$