fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. string s;
  7. cin>>s;
  8. vector<char>v;
  9. for(auto i:s)
  10. {
  11. if(i!='+')
  12. v.push_back(i);
  13. }
  14. sort(v.begin(),v.end());
  15. for(int i=0;i<v.size();i++)
  16. {
  17. cout<<v[i];
  18. if(i!=v.size()-1)
  19. {
  20. cout<<"+";
  21. }
  22. }
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5320KB
stdin
1+1+3+1+3
stdout
1+