Today Arthur has got not the best day of his life. Today is Thursday and in the morning he had to lie under a bulldozer, which was pulling down his house, and his planet is destroyed, and Marvin is a pain in the neck. And now
Arthur is standing in front of Vl'hurgs' commander and he has to speak, otherwise in the space-time continuum a tiny crack will appear and so on... May be exactly Arthur will have this crack. For example, in the bones of his skull. So, he is to speak immediately and certainly in Vl'hurgish. There's only one problem: the only thing that Arthur has heard in Vl'hurgish is the demand to surrender that was proclaimed a second ago. The Hitchhiker's Guide to the Galaxy can only prompt to Arthur that the Vl'hurgish language is very complicated. There are millions of rules and some of them are very amusing. For instance, no Vl'hurgish word can be pronounced for more seconds than the number of letters it consists of. They don't like mumblers. It's known as well that Vl'hurgs don't like when replying to some remark you use any of the two-word combinations that were contained in the original remark. In this case they may think that you parody them and parodists are out of favor among Vl'hurgs. But Arthur is to say something! He has decided to repeat the phrase of Vl'hurgs' commander having thrown out just several words and not changing their order. What else can he do? Just gain time pronouncing each word as long as it is possible.
But how much time can he gain this way?
Input
The input contains a phrase of Vl'hurgs' commander. The words consist just of lower-case and capital Latin letters. Any other symbols are word separators. The phrase
doesn't contain two equal words (the case of letters should be ignored). The length of any Vl'hurgish word is not greater than 100. The amount of words in one phrase doesn't exceed 10000. Total input size doesn't exceed 512 KB.
Output
Output a single number: the maximal time in seconds that Arthur may speak. Of course, Arthur doesn't want to seem a mumbler or parodist.
Sample
input | output |
---|
You have come a long way
| 11
|
Notes
In the sample Arthur should say "You come long".
Problem Author: Den Raskovalov (idea by Magaz Asanov)
Problem Source: The Ural State University Championship, October 29, 2005