Harry and String
Practice
3.1 (14 votes)
Algorithms
Easy
Hiring
String manipulation
Problem
63% Success 6567 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Harry was studying a magic book that categorizes the magic spells into 3 categories - Good , Worst and Bad. If any spell contains all the vowels in alphabetical order then that spell is categorized as Good. If it contains the vowels in reverse alphabetical order , then that spell is categorized as Worst. All the other spells that do not fall in any of the categories before are categorized as Bad. 

Now Harry tries to evaluate himslef by solving a spell categorization exercise at the end of the book , but since he is confused can you help him by solving the problems.

Note: The spell is a word of lower case English alphabets only. If there are no vowels in the string, then the spell is classified as "Good".

Input Format

The first line of input consists of an integer $$T$$ denoting the number of spells that need to be classified. Each of the next $$T$$ lines contains a word $$S$$.

Output Format

For each string, output the category to which the spell belongs in a new line.

Constraints

$$1 \le T \le 10^5$$
$$1 \le |S| \le 10^5$$ where $$|S|$$ is the length of spell word.

The sum of length of all the words never exceeds 107.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
29 votes
Tags:
AlgorithmsApprovedImplementationMediumOpenTrees
Points:20
553 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyOpenReady
Points:20
40 votes
Tags:
AlgorithmsArraysString ManipulationString manipulation