Problem I
Thesaurus
After staying up all night, Yraglac has finally finished writing the essay for his assignment. However, he just noticed at the last minute that his essay exceeds the maximum permissible length!
Since Yraglac has little time left, he doesn’t want to spend too much time changing his essay. At the same time, he doesn’t want to change the meaning of his essay. He came up with a genius plan for solving his predicament: he will replace every word with the shortest possible synonym!
The essay consists of
What is the minimum number of characters (excluding spaces) in the essay assuming every word is replaced with the shortest possible synonym?
Input
The first line of the input contains two integers
The next line of the input represents the essay, which
contains
The remaining
It is guaranteed that no string in the input contains more
than
Output
Output a single integer denoting the minimum number of characters in the essay excluding spaces if every word is replaced with the shortest possible synonym.
Sample Input 1 | Sample Output 1 |
---|---|
10 4 to be or not to be that is the investigation investigation question that foobar foobar fb to blah |
28 |