Run ID:151305
提交时间:2026-04-11 16:33:03
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int main() { string s; while (cin >> s) { vector<long long> res; string tmp; for (char c : s) { if (c == '5') { if (!tmp.empty()) { res.push_back(stoll(tmp)); tmp.clear(); } } else { tmp += c; } } // 处理最后一段 if (!tmp.empty()) res.push_back(stoll(tmp)); sort(res.begin(), res.end()); for (int i = 0; i < res.size(); ++i) { if (i > 0) cout << ' '; cout << res[i]; } cout << endl; } return 0; }