Logo
(追記) (追記ここまで)

33119번 - Scrambled Scrabble 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB54393581.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.

  • The letters A, E, I, O, and U can only form a vowel.
  • The letter Y can form either a vowel or a consonant.
  • Each of the remaining letters other than A, E, I, O, U, and Y can only form a consonant.
  • The string 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.

제한

예제 입력 1

ICPCJAKARTA

예제 출력 1

9

A possible longest word is JAKCARTAP, consisting of the syllables JAK, CAR, and TAP.

예제 입력 2

NGENG

예제 출력 2

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.

예제 입력 3

YYY

예제 출력 3

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.

예제 입력 4

DANGAN

예제 출력 4

6

The whole string $S$ is a word consisting of two syllables: DAN and GAN.

예제 입력 5

AEIOUY

예제 출력 5

0

힌트

출처

ICPC > Regionals > Asia Pacific > Indonesia > Jakarta > The 2024 ICPC Asia Jakarta Regional Contest A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /