fork download
  1. import java.util.*;
  2.  
  3. public 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. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
8
Algorithm Crunching Man
Green Lantern
Boba Fett
Superman
Batman
Green Goblin
Barney
Spider Pig
compilation info
Main.java:3: class sponge is public, should be declared in a file named sponge.java
public class sponge {
       ^
1 error
stdout
Standard output is empty