#include<bits/stdc++.h>
using namespace std;
signed main()
{
string s;
cin>>s;
int a[4]={0};
int count=0;//加号的数量
for(int i=0;i<s.size();i++){
if(s[i]!='+'){
a[s[i]-'0']++;
}
else{
count++;
}
}
if(count==0&&s.size()!=0){
cout<<s[0];
}
while(count){
while(a[1]){
cout<<1;
if(count!=0){
cout<<"+";
count--;
}
a[1]--;
}
while(a[2]){
cout<<2;
if(count!=0){
cout<<"+";
count--;
}
a[2]--;
}
while(a[3]){
cout<<3;
if(count!=0){
cout<<"+";
count--;
}
a[3]--;
}
}
}
Codeforces Helpful Maths题解
于 2024-04-06 21:38:04 首次发布