문제1233--Nice Or Ugly

1233: Nice Or Ugly

실행시간 제한: 2 Sec  메모리사용 제한: 128 MB
제출: 93  통과: 19
[제출] [채점기록] [묻고답하기]

문제 설명

A string is called ugly if it has 3 vowels in a row, or 5 consonants in a row, or both. A string is called nice if it is not ugly. You are given a string S, consisting of uppercase letters ('A'-'Z') and question marks ('?'). Return "UGLY" if the string is definitely ugly (that means you cannot substitute letters for question marks so that the string becomes nice), "NICE" if the string is definitely nice, and "42" if it can be either ugly or nice (quotes for clarity only).

Notes -  The letters 'A', 'E', 'I', 'O', 'U' are vowels, and all others are consonants.

입력 설명

The first line contains the number of test cases T (T ≤ 1,000).
Each of the following T lines contains S.

Constraints
- S will contain between 1 and 50 characters, inclusive.
- Each character in s will be either '?', or an uppercase letter ('A'-'Z').
 

출력 설명

Output the answer of each test case on a separate line.

입력 예시 Copy

5
HELLOWORLD
ABCDEFGHIJKLMNOPQRSTUVWXYZ
HELLOW?RLD
H??LOWOR??
EE?FFFF

출력 예시 Copy

NICE
UGLY
42
NICE
UGLY

출처/분류