借放程式碼,這題會getline跟刪除+號就可以AC了
//AC e465 f605 i399 k918 k900 k920 k921 d074 d478 b572 k645
//WA d098 d115
#include <bits/stdc++.h>
#define fast_as_a_fuckboy ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main() {
fast_as_a_fuckboy
string s;
vector<int> v;
getline(cin, s);
stringstream ss(s);
int num;
while (ss >> num) {
v.push_back(num);
if (ss.peek() == '+') { //跳過"+"
ss.ignore();
}
}
sort(v.begin(),v.end()); //排序
for(int i = 0; i < v.size(); i++){
cout << v[i];
if(i != v.size() - 1){
cout << "+";
}
}
}