#include <iostream>
#include <string>
using namespace std;
int num[26]={1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,4,1,2,3,1,2,3,4};
main()
{
int t,i,j;
string s;
cin>>t;
cin.ignore();//在讀取下一行前,忽視enter,才能正常執行
for(i=1; i<=t; i++)
{
getline(cin,s);
int ans=0;
for(j=0; j<s.size(); j++)
if(s[j]==' ') ans++;
else ans+=num[s[j]-'a'];
cout<<"Case #"<<i<<": "<<ans<<endl;
}
}