fork download
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(false);
  9. cin.tie(NULL);
  10.  
  11. int sizee ;
  12. cin >> sizee ;
  13. string s ;
  14. cin >> s ;
  15. int count[123]={0} ;
  16.  
  17. for (int x=0 ; x<sizee ; x++)
  18. {
  19. count[s[x]] ++ ;
  20. }
  21. int y=97 ;
  22. int x=sizee ;
  23. while(x)
  24. {
  25. for (int z=0 ; z<count[y] ; z++)
  26. {
  27. char c=y ;
  28. cout << c ;
  29. x-- ;
  30. }
  31. y++ ;
  32. }
  33.  
  34.  
  35. return 0;
  36. }
Success #stdin #stdout 0s 5524KB
stdin
Standard input is empty
stdout
Standard output is empty