#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
using namespace std;
string solve(string &s);
int main()
{
int t;
string s;
#ifndef ONLINE_JUDGE
ifstream cin("d:\\OJ\\uva_in.txt");
#endif
cin >> t;
for (int i = 1; i <= t; i++) {
cin >> s;
cout << "Case " << i << ": ";
cout << solve(s) << endl;
}
return 0;
}
string solve(string &s)
{
char cur;
int count = 0;
string res = "";
for (size_t i = 0; i < s.length(); ) {
if (isalpha(s[i])) {
cur = s[i];
i++;
} else if (isdigit(s[i])) {
while (i < s.length() && isdigit(s[i])) {
count = count * 10 + (s[i] - '0');
i++;
}
res.append(count, cur);
count = 0;
}
}
return res;
}
UVa11541 - Decoding
最新推荐文章于 2024-05-11 10:43:42 发布