fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int N;cin >> N;
  7. string S;cin >> S;
  8. char temp = 0;
  9. for (int i = 0; i < N -1; i++)
  10. {
  11. for (int j = 0; j < N -1; j++)
  12. {
  13. if (S[j] > S[j +1])
  14. {
  15. temp = S[j];
  16. S[j] = S[j +1];
  17. S[j +1] = temp;
  18. }
  19.  
  20. }
  21. }
  22. cout << S;
  23. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty