A digit word is a word where, after possibly removing some letters, you are left with one of the single digits: ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT or NINE (not ZERO).
For example, BOUNCE and ANNOUNCE are digit words, since they contain the digit one.
ENCODE is not a digit word, even though it contains an O, N and E, since they are not in order.
Write a program/function which takes a single (uppercase or lowercase -- you choose) word as input or a parameter and determines if it is a digit word. Make the code as short as possible.
If the word is not a digit word, you should return 'NO', 0 or any 'falsey' value (this may vary based on your language). If the word is a digit word, you should output the digit it contains, as a number.
You can assume that no words contain more than one digit, so you won't have anything like ONFIVE.
Test Cases
BOUNCE
1
ENCODE
NO
EIGHT
8
BLACKJACK
NO
FABULOUS
NO
EXERCISE
NO
DRIFTWOOD
2
SERVICEMAN
7
INSIGNIFICANCE
9
THROWDOWN
2
ZERO
NO
OZNERO
1
This challenge is taken from (and is a very slight modification of) Question 1 from BIO 2009. Most of the test cases are taken from the mark scheme.
NOFELINEVET
contains both 5 and 9 ... what should I return? \$\endgroup\$0
in the no-digit-found case even if it's not falsey in the language of choice? \$\endgroup\$