#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#define pb push_back
#define file { freopen(“input.txt”,”r”,stdin);}
using namespace std;
int main()
{
int n,t,len,k=0;
char ch,name[201];
char num[201];
name[0]=’\x0′;
int cs=0;
//file
scanf(“%d”,&t);
while(t–){
scanf(“%s”,&name);
len=strlen(name);
name[len]=’\x0′;
int i,j;
num[0]=’\x0′;
k=0;
printf(“Case %d: “,++cs);
for(i=0;i<len; ){
ch=name[i];
j=i+1;
while((name[j]>=48)&&(name[j]<=57)){
num[k]=name[j];
j++;
k++;
}
num[k]=’\x0′;
if(k>1)
n=atoi(num);
else
n=num[0]-48;
for(j=0;j<n;j++){
printf(“%c”,ch);
}
i=i+k+1;
k=0;
ch=’\x0′;
}
printf(“\n”);
name[0]=’\x0′;
}
return 0;
}
No comments:
Post a Comment