This page is still under construction.

Parts of this page are still being built. What you see may change.

The Good and the Bad

Interview

Time limit1sMemory limit128 MB

Summary
Count the letters g and b in each hero name, ignoring case, and print whether the name is GOOD, A BADDY, or NEUTRAL.
Level

Easy1 of 10

Topics
String, Implementation, Brute force
Solved
No attempts yet

Problem

Bikini Bottom is teeming with superheroes who have superpowers. SpongeBob and Patrick want to decide, from a hero's name alone, whether that hero is one of the good guys or one of the baddies.

  • SpongeBob: Wow, I can feel great power in this name! But I can't tell whether it belongs to a good guy or a bad guy.
  • Patrick: Easy. Just count the letter 'g' and the letter 'b' in the name. More 'g' than 'b' means a good guy; more 'b' than 'g' means a baddy. Look at the mighty hero 'Algorithm Crunching Man' — it has two 'g's and no 'b'.
  • SpongeBob: Oh, I see. So 'Green Lantern' is good and 'Boba Fett' is a baddy?
  • Patrick: Correct! And letters are case-insensitive: count 'G' as 'g' and 'B' as 'b'.
  • SpongeBob: Then what about 'Superman'?
  • Patrick: He has no 'g' and no 'b', so the counts are equal — he's neutral.
  • SpongeBob: Ah, so even when there are zero 'g's and zero 'b's, equal counts mean neutral.
  • Patrick: Right. Let's go through the names one by one.
  • SpongeBob: Do we really have to count all of these ourselves all day?
  • Patrick: Then let's hand it to the human who's been eavesdropping on us. Do a good job and I'll buy you a Krabby Patty.

Help SpongeBob and Patrick decide whether each hero is good or bad.

Rules:

  • Let gg be the number of 'g'/'G' in the name and bb the number of 'b'/'B'.
  • If g>bg > b, the hero is good (GOOD).
  • If b>gb > g, the hero is a baddy (A BADDY).
  • If g=bg = b (including when both are 0), the hero is neutral (NEUTRAL).

Input

The first line contains the number of test cases nn (n>0n > 0).

Each of the next nn lines contains one hero name. Each name has at least 1 character and at most 25 characters.

Names consist only of uppercase and lowercase English letters and spaces. Spaces separate the words of a multi-word name.

Output

For each name, print one line: the hero's name exactly as given, followed by a single space and is.

Then print GOOD, A BADDY, or NEUTRAL according to the counts of 'g' and 'b' in the name. In other words, each line has the form <name> is <verdict>.

Examples1

  1. Example 1

    Input
    8
    Algorithm Crunching Man
    Green Lantern
    Boba Fett
    Superman
    Batman
    Green Goblin
    Barney
    Spider Pig
    
    Expected output
    Algorithm Crunching Man is GOOD
    Green Lantern is GOOD
    Boba Fett is A BADDY
    Superman is NEUTRAL
    Batman is A BADDY
    Green Goblin is GOOD
    Barney is A BADDY
    Spider Pig is GOOD