#include<bits/stdc++.h>
#include<string.h>
int main()
{
char a[107];
long int n,s,j,t,i=0;
scanf("%ld",&t);
getchar();
while(t--)
{
gets(a);
s=0;
n=strlen(a);
for(j=0; j<n; j++)
{
if((a[j]=='a')||(a[j]=='d')||(a[j]=='g')||(a[j]=='j')||(a[j]=='m')||(a[j]=='p')||(a[j]=='t')||(a[j]=='w')||(a[j]==' '))
s+=1;
else if((a[j]=='b')||(a[j]=='e')||(a[j]=='h')||(a[j]=='k')||(a[j]=='n')||(a[j]=='q')||(a[j]=='u')||(a[j]=='x'))
s+=2;
else if((a[j]=='c')||(a[j]=='f')||(a[j]=='i')||(a[j]=='l')||(a[j]=='o')||(a[j]=='r')||(a[j]=='v')||(a[j]=='y'))
s+=3;
else if((a[j]=='s')||(a[j]=='z'))
s+=4;
}
printf("Case #%ld: %ld\n",++i,s);
}
return 0;
}
#include<string.h>
int main()
{
char a[107];
long int n,s,j,t,i=0;
scanf("%ld",&t);
getchar();
while(t--)
{
gets(a);
s=0;
n=strlen(a);
for(j=0; j<n; j++)
{
if((a[j]=='a')||(a[j]=='d')||(a[j]=='g')||(a[j]=='j')||(a[j]=='m')||(a[j]=='p')||(a[j]=='t')||(a[j]=='w')||(a[j]==' '))
s+=1;
else if((a[j]=='b')||(a[j]=='e')||(a[j]=='h')||(a[j]=='k')||(a[j]=='n')||(a[j]=='q')||(a[j]=='u')||(a[j]=='x'))
s+=2;
else if((a[j]=='c')||(a[j]=='f')||(a[j]=='i')||(a[j]=='l')||(a[j]=='o')||(a[j]=='r')||(a[j]=='v')||(a[j]=='y'))
s+=3;
else if((a[j]=='s')||(a[j]=='z'))
s+=4;
}
printf("Case #%ld: %ld\n",++i,s);
}
return 0;
}
No comments:
Post a Comment