| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 54 | 39 | 35 | 81.395% |
You are playing a word game using a standard set of 26ドル$ uppercase English letters: A-Z. In this game, you can form vowels and consonants as follows.
A, E, I, O, and U can only form a vowel.Y can form either a vowel or a consonant.A, E, I, O, U, and Y can only form a consonant.NG can form a single consonant when concatenated together.Denote a syllable as a concatenation of a consonant, a vowel, and a consonant in that order. A word is a concatenation of one or more syllables.
You are given a string $S$ and you want to create a word from it. You are allowed to delete zero or more letters from $S$ and rearrange the remaining letters to form the word. Find the length of the longest word that can be created, or determine if no words can be created.
A single line consisting of a string $S$ (1ドル ≤ |S| ≤ 5000$). The string $S$ consists of only uppercase English letters.
If a word cannot be created, output 0ドル$. Otherwise, output a single integer representing the length of longest word that can be created.
ICPCJAKARTA
9
A possible longest word is JAKCARTAP, consisting of the syllables JAK, CAR, and TAP.
NGENG
5
The whole string $S$ is a word consisting of one syllable which is the concatenation of the consonant NG, the vowel E, and the consonant NG.
YYY
3
The whole string $S$ is a word consisting of one syllable which is the concatenation of the consonant Y, the vowel Y, and the consonant Y.
DANGAN
6
The whole string $S$ is a word consisting of two syllables: DAN and GAN.
AEIOUY
0