fork(1) download
  1. #include <iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. int main() {
  6. string s;
  7. cin>>s;
  8. int z = s.length();
  9. for(int i = 2;i <= z; i+=2 )
  10. {
  11.  
  12. if(s[i-2] > s[i] )
  13. swap(s[i-2],s[i]);
  14.  
  15. }
  16. cout<<s;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5344KB
stdin
3+2+1
stdout
2+1+3