fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define ld long double
  7.  
  8. void Free_palestine() {
  9. ios::sync_with_stdio(false);
  10. cin.tie(NULL);
  11. cout.tie(NULL);
  12. }
  13.  
  14. const int N = 2e5 + 5;
  15. const int MOD = 1e9 + 7;
  16.  
  17. signed main(){
  18. Free_palestine();
  19.  
  20. int n; cin>>n;
  21. int freq[26]={};
  22. while(n--){
  23. char x;
  24. cin>>x;
  25. freq[x-'a']++;
  26.  
  27. }
  28. for(int i=0;i<26;i++){
  29. if(freq[i]){
  30. while(freq[i]--){
  31. cout<<char(i+'a');
  32. }
  33. }
  34. }
  35. return 0;
  36. }
Success #stdin #stdout 0.01s 5284KB
stdin
5
egypt
stdout
egpty