#include<bits/stdc++.h>
using namespace std;
int main()
{
int t, i, j = 1;
cin >> t;
while(t--)
{
string s[52];
for(i=0;i<52;i++)
cin >> s[i];
int y = 0, value = 0, index = 26;
for(i=1;i<=3;i++)
{
if(s[index][0] == 'A' || s[index][0] == 'S' || s[index][0] == 'J' || s[index][0] == 'Q' || s[index][0] == 'T')
value = 10;
else
value = s[index][0] - '0';
y = y + value;
index = index - 1 - (10 - value);
}
if(y > index)
{
int x = 26 - index;
index = y + x - 1;
}
cout << "Case " << j++ << ": " << s[index] << "\n";
}
return 0;
}
Comments
Post a Comment