fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. string s;
  6. cin >> s;
  7. vector<char> v;
  8. int n = s.size();
  9. for (int i = 0; i < n; i++)
  10. {
  11. if (s[i] != '+')
  12. {
  13. v.push_back(s[i]);
  14. }
  15. }
  16. sort(v.begin(), v.end());
  17. bool first = true;
  18. for (auto i : v)
  19. {
  20. if (first)
  21. {
  22. cout << i;
  23. first=false;
  24. }
  25. else
  26. {
  27. cout << "+" << i;
  28. }
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty