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
| #include <iostream> #include <string> #include <vector> #include <sstream> #include <algorithm>
using namespace std;
int main() { string s; while (getline(cin, s)) { stringstream line(s); string x; vector<string> res; while (getline(line, x, ',')) res.push_back(x); sort(res.begin(), res.end()); for (int i = 0; i < res.size(); i ++ ) { if (i == res.size() - 1) cout << res[i] << endl; else cout << res[i] << ","; } } return 0; }
|