Problem B
Casting Spells
Casting spells is the least understood technique of dealing
with real life. Actually, people find it quite hard to
distinguish between real spells like “abrahellehhelleh” (used
in the battles and taught at the mage universities) and screams
like “rachelhellabracadabra” (used by uneducated witches for
shouting at cats). Finally, the research conducted at the
Unheard University showed how one can measure the power of a
word (be it a real spell or a scream). It appeared that it is
connected with the mages’ ability to pronounce words backwards.
(Actually, some singers were burned at the stake for exactly
the same ability, as it was perceived as demonic possession.)
Namely, the power of a word is the length of the maximum
subword of the form
Input
The input is a single line containing a word of length
Output
You should output one integer
Sample Input 1 | Sample Output 1 |
---|---|
abrahellehhelleh |
12 |
Sample Input 2 | Sample Output 2 |
---|---|
rachelhellabracadabra |
0 |