#include <string.h>
int main()
{
char a[100];
int m,sum,i,t,c,j;
while(scanf("%d",&t)!=EOF)
{
for(i=1;i<=t;i++)
{
scanf("%d",&c);
printf("Case %d:\n",i);
if(c>0)
{
sum=0;
for(j=1;j<=c;j++)
{
scanf("%s",a);
if(strcmp(a,"donate")==0)
{
scanf("%d",&m);
sum=sum+m;
}
if(strcmp(a,"report")==0)
{
printf("%d\n",sum);
}
}
}
}
}
return 0;
}
0 comments:
Post a Comment