All Tracks Algorithms String Algorithms Basics of String Manipulation Problem

Harry and String
/

Algorithms, String Manipulation

Problem
Editorial
Analytics

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.

SAMPLE INPUT
3
discount
weak
goalkeeper
SAMPLE OUTPUT
Good
Worst
Bad
Explanation

For case 1, the vowels in the spell are i,o and u and they occur in the alphabetical order in the string, so this is a "Good" string.

For case 2, the vowels in the spell are e and a and they occur in reverse order of the alphabetical order in the string, so this is a "Worst" string.

For case 3, the vowels in the spell are o, a and e and they occur neither in the reverse order nor in the same order as alphabetical, so this is a "Bad" string.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?