//////////////////////利用atoi()算每個字元後面的數量/////////////////////////
int main()
{
int t = 0,k=0,i=0,temp=0,count=1;
char input[400] = { '\0' };
char ch;
char num[1000] = { '\0' };
scanf("%d", &t);
getchar();
while (t)
{
gets(input);
printf("Case %d: ", count);
for (i = 0; i < strlen(input); i++)
{
if (input[i] >= 'A' && input[i] <= 'Z')
{
if (i != 0)
{
temp= atoi(num);
for (int a = 0; a < temp; a++)
{
printf("%c", ch);
}
memset(num, '\0', sizeof(num));
}
ch = input[i];
k = 0;
}
else if (input[i]>='0' && input[i]<='9')
{
// printf("hello");
num[k] = input[i];
k++;
}
}
temp = atoi(num);
for (int a = 0; a < temp; a++)
{
printf("%c", ch);
}
printf("\n");
memset(num, '\0', sizeof(num));
k = 0;
count++;
t--;
}
return 0;
}