|  | 
|  | 
| back to board | c WA why? #include<stdio.h>void main()
 {
 int n,i;
 int e=0,m=0,l=0,max;
 char ch;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
 fflush(stdin);
 ch=getchar();
 switch(ch)
 {
 case 'E':e++;break;
 case 'M':m++;break;
 case 'L':l++;
 }
 }
 max=e;ch='E';
 if(m>max){max=m;ch='M';}
 if(l>max) ch='L';
 switch(ch)
 {
 case 'E':printf("Emperor Penguin");break;
 case 'M':printf("Macaroni Penguin");break;
 case 'L':printf("Little Penguin");
 }
 }
Re: c WA why? Do not use<stdio.h>
 instead you better to use
 
 #include <iostream>
 using namespace std;
 
 good luck
Re: c WA why? I never use iostream. Try to add \n to output.Re: c WA why?---Change your code like this...!--Good Luck #include<stdio.h>void main()
 {
 int n,i,e=0,m=0,l=0,max;
 char ch[30];
 scanf("%d",&n);
 for(i=0;i<2*n;i++)
 {
 scanf("%s",ch);
 switch(ch[0])
 {
 case 'E':e++;break;
 case 'M':m++;break;
 case 'L':l++;
 }
 }
 max=e;ch[0]='E';
 if(m>max){max=m;ch[0]='M';}
 if(l>max) ch[0]='L';
 switch(ch[0])
 {
 case 'E':printf("Emperor Penguin");break;
 case 'M':printf("Macaroni Penguin");break;
 case 'L':printf("Little Penguin");
 }
 }
 | 
 | 
|