/*DPACM2011 Chris Gayle cricket bating.*/
# include<stdio.h>
# include<string.h>
# include<conio.h>
# define size 100
int main()
{
int test,i,j,length,total,one,two,six,four,three,five,dot;
char c,boll[size];
scanf("%d",&test);
c=getchar();
for(i=1;i<=test;i++)
{
one=0,two=0,six=0,four=0,three=0,five=0,dot=0;
gets(boll);
length=strlen(boll);
for(j=0;j<length;j++)
{
if(boll[j]=='1')
one++;
if(boll[j]=='2')
two++;
if(boll[j]=='3')
three++;
if(boll[j]=='4')
four++;
if(boll[j]=='5')
five++;
if(boll[j]=='6')
six++;
if(boll[j]=='.')
dot++;
}
total=one*1+two*2+six*6+four*4+three*3+five*5;
printf("Match %d:\nSixes %d\nFours %d\nThrees %d\nTwos %d\nOnes %d\nDots %d\nTotal runes scored %d\n",i,six,four,three,two,one,dot,total);
}
getch();
return 0;
}
From:
Sumon Sarker
Sumon Sarker