fork download
  1. import java.util.*;
  2.  
  3. class sponge {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6. int tc = scan.nextInt();
  7. scan.useDelimiter("\n");
  8. for(int i=0; i<tc; i++) {
  9. int count = 0;
  10. String s;
  11. s = scan.next();
  12.  
  13. for(int j=0; j<s.length(); j++) {
  14. if( s.charAt(j) == 'b' ) count--;
  15. if(s.charAt(j) == 'g') count++;
  16. if( s.charAt(j) == 'B' ) count--;
  17. if(s.charAt(j) == 'G') count++;
  18.  
  19. }
  20. System.out.print(s);
  21. if( count >0) {
  22. System.out.print(" is GOOD"+"\n");
  23. }
  24. if( count<0 ) {
  25. System.out.print(" is A BADDY"+"\n");
  26. }
  27. if( count ==0 ) {
  28. System.out.print(" is NEUTRAL" +"\n");
  29. }
  30. }
  31. }
  32. }
Success #stdin #stdout 0.11s 212864KB
stdin
8
Algorithm Crunching Man
Green Lantern
Boba Fett
Superman
Batman
Green Goblin
Barney
Spider Pig
stdout
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