fork(1) download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. using namespace std;
  5. int main()
  6. {
  7. string str="";
  8. cin>>str;
  9. vector <char > mv;
  10. for(int i=0;i<str.length();i++)
  11. {
  12. if(str[i]>='A'&&str[i]<='Z')
  13. {
  14. mv.push_back(str[i]);
  15. str[i]+=32;
  16. }
  17. }
  18. sort(str.begin(),str.end());
  19. for(int i=0;i<mv.size();i++)
  20. for(int j=0;j<str.length();j++)
  21. {
  22. if(str[j]>='A'&&str[j]<='Z')
  23. continue;
  24. if(str[j]==(mv[i]+32))
  25. {
  26. str[j] -= 32;
  27. break;
  28. }
  29. }
  30. cout<<str<<"\n";
  31. return 0;
  32. }
Success #stdin #stdout 0s 16056KB
stdin
World
stdout
dlorW