Skip to main content
1 of 5
Calvin's Hobbies
  • 90k
  • 46
  • 339
  • 555

Thorough Semantic Satiation

To each of these nine 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 non-empty string consisting of any uppercase and lowercase letters (A-Z a-z). If the input is one of the nine words listed above, output the number you assigned to it. If the input is not one of the words above, output 0.

The words are case sensitive, e.g. thoreau, Throw, and THROW should all produce 0.

##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.

If any other string is input, 0 should be output.

##Details

  • Take the input string via stdin or the command line and output to stdout.
  • You may assume the input is a non-empty string consisting only of letters.
  • 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.
Calvin's Hobbies
  • 90k
  • 46
  • 339
  • 555