|
|
вернуться в форумWhy crashing? import java.io.*; import java.util.Scanner; public class string { public static void main(String args[]) throws IOException { Scanner sc = new Scanner(System.in); BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); String each; int m=0,l=0,e=0; int num = sc.nextInt(); for(int i=0;i<num;i++) { each = bufferedreader.readLine(); if(each.charAt(0)=='M') { m++; } else if(each.charAt(0)=='L') { l++; } else if(each.charAt(0)=='E') { e++; } } if((m>=l) && (m>=e)) System.out.println("Macaroni Penguin"); if((l>=m) && (l>=e)) System.out.println("Little Penguin"); if((e>=m) && (e>=l)) System.out.println("Emperor Penguin");
} Re: Why crashing? Same question, maybe related with BufferedReader. Several times faced with this problem, any idea? |
|
|