#include<iostream> #include<string> #include <map> #include <vector> #include <sstream> using namespace std; int main() { string input; cin>>input; multimap<int,string> mup; vector<string> vString; vector<int> vCount; string scount = ""; string temp = ""; for(int i=0; i<input.size();i++) { if (input[i] >= '0' && input[i] <= '9') { if(temp != "") { vString.push_back(temp); //vCount.push_back(input[i]-'0'); scount+=input[i]; temp = ""; } else { scount+=input[i]; } } else { if (scount != "") { stringstream ss; ss<<scount; int t; ss>>t; vCount.push_back(t); scount = ""; } temp += input[i]; } } stringstream ss; ss<<scount; int t; ss>>t; vCount.push_back(t); for (int i=0;i<vCount.size();i++) { mup.insert(make_pair(vCount[i],vString[i])); } string result = ""; multimap<int,string>::iterator it; for(it = mup.begin();it != mup.end();++it) { int n = it->first; string s = it->second; for(int i=0; i<n; i++) { result+=s; } } cout << result << endl; return 0; }
点赞 评论

相关推荐

01-30 22:03
门头沟学院 Java
用微笑面对困难:我滴妈,【俩月】【实习】【主管】仨debuff吃满了,独立设计开发的项目写了绝大占比的运营板块,你独立开发,那维护、问题复盘、日志更新、bug、策划书全是自己整的? 不建议写那么大,可以从小出发更容易
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务