couldn't you ignore punctuation and do something like "if (input_string.contains("twelve") then ++twelve_counter"?
If you know your input precisely (and probably already know how many of each word).
Otherwise, you could easily catch words that appear in a longer, different word, resulting in erroneous counts.