#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[26];
a[0] = a[3] = a[6] = a[9] = a[12] = a[15] = a[19] = a[22] = 1;
a[1] = a[4] = a[7] = a[10] = a[13] = a[16] = a[20] = a[23] = 2;
a[2] = a[5] = a[8] = a[11] = a[14] = a[17] = a[21] = a[24] = 3;
a[18] = a[25] = 4;
int c = 0, n, j;
string s;
while(cin >> n)
{
getchar();
for(j=1; j<=n; j++)
{
getline(cin , s);
int l = s.size(), i;
c = 0;
for(i=0; i<l; i++)
{
if(s[i] == ' ')
{
c++;
continue;
}
int p = s[i] - 97;
c += a[p];
}
cout << "Case #" << j << ": " << c << endl;
}
}
return 0;
}
using namespace std;
int main()
{
int a[26];
a[0] = a[3] = a[6] = a[9] = a[12] = a[15] = a[19] = a[22] = 1;
a[1] = a[4] = a[7] = a[10] = a[13] = a[16] = a[20] = a[23] = 2;
a[2] = a[5] = a[8] = a[11] = a[14] = a[17] = a[21] = a[24] = 3;
a[18] = a[25] = 4;
int c = 0, n, j;
string s;
while(cin >> n)
{
getchar();
for(j=1; j<=n; j++)
{
getline(cin , s);
int l = s.size(), i;
c = 0;
for(i=0; i<l; i++)
{
if(s[i] == ' ')
{
c++;
continue;
}
int p = s[i] - 97;
c += a[p];
}
cout << "Case #" << j << ": " << c << endl;
}
}
return 0;
}
Comments
Post a Comment