-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp11541.cpp
45 lines (41 loc) · 970 Bytes
/
p11541.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<bits/stdc++.h>
using namespace std;
int main()
{
int T; cin>>T;
for(int t=1;t<=T;t++)
{
string a;
cin>>a;
int dg,x=0;
int len=a.size();
cout<<"Case "<<t<<": ";
for(int i=0;i<len;i++)
{
if(isdigit(a[i]))
{
dg=a[i]-'0';
if(isdigit(a[i+1]))
{
int t=a[i+1]-'0';
dg=(dg*10)+t;
if(isdigit(a[i+2]))
{
t=a[i+2]-'0';
dg=(dg*10)+t;
}
}
for(int j=1;j<=dg;j++)
{
cout<<a[i-1];
}
if(dg>99)
i+=2;
else if(dg>9)
i++;
}
}
cout<<endl;
}
return 0;
}