ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1585. Penguins

My Successfully code
Posted by Paata Julakidze 30 May 2013 14:47
import  java.util.*;
public class Penguins1585 {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        int a=0,b=0,c=0;
        for(int i=0; i<n; i++){
            String s = in.nextLine();
            String s1=s.substring(0,1);
            if(s1.equals("E"))a++;
            else if(s1.equals("M"))b++;
            else c++;
        }

        if(a>=b && a>=c)System.out.print("Emperor Penguin");
        else if(b>=a && b>=c) System.out.print("Macaroni Penguin");
        else System.out.print("Little Penguin");



    }

}