Time limit
2s
Memory limit
128 MB
When typing Korean on a computer, a key sequence can be written as the English letters printed on a standard 2-beolsik Korean keyboard. Given such a string, scan it from left to right and check whether it can still be composed into Korean syllables by the standard 2-beolsik composition rules. If reading a character makes composition impossible, that character's position is the first typo. If the string ends while the last syllable has only an initial consonant and is not complete, the position of that initial consonant is the first typo.
The first line contains the typed string. Each character is an English letter representing a key on a 2-beolsik Korean keyboard.
Print the 1-based position of the first typo. If there is no typo, print 0.