-
Notifications
You must be signed in to change notification settings - Fork 0
/
uva 11530.cpp
35 lines (32 loc) · 910 Bytes
/
uva 11530.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<stdio.h>
#include<string.h>
int main()
{
int p,i,n,len,k;
char ch[102];
while(scanf("%d",&n)==1)
{
for(k=0;k<=n;k++)
{
gets(ch);
p=0;
len=strlen(ch);
for(i=0;i<=len;i++)
{
if (ch[i]=='a'|| ch[i]=='d'|| ch[i]=='g'|| ch[i]=='j'|| ch[i]=='m'||
ch[i]=='p'|| ch[i]=='t'|| ch[i]=='w'|| ch[i]==' ' )
p=p+1;
else if (ch[i]=='b'|| ch[i]=='e'|| ch[i]=='h'|| ch[i]=='k'|| ch[i]=='n'||
ch[i]=='q'|| ch[i]=='u'|| ch[i]=='x' )
p=p+2;
else if (ch[i]=='c'|| ch[i]=='f'|| ch[i]=='i'|| ch[i]=='l'|| ch[i]=='o'||
ch[i]=='r'|| ch[i]=='v'|| ch[i]=='y' )
p=p+3;
else if(ch[i]=='s'||ch[i]=='z')
p=p+4;
}
if(k!=0)
printf("Case #%d: %d\n",k,p);
}
}
}