Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. //
  2. // main.cpp
  3. // ol
  4. //
  5. // Created by Roman L. on 26/02/2017.
  6. // Copyright © 2017 Roman L. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10. #include <algorithm>
  11. using namespace std;
  12. int main(int argc, const char * argv[]) {
  13.  
  14.  
  15. string s;
  16. cin >> s;
  17. sort(s.begin(), s.end());
  18. int i=s.size()-1;
  19. while(i>=0){
  20. cout << s[i];
  21. i--;
  22. }
  23. if(s[0]=='0'){
  24. i = 0;
  25. while(s[i]=='0') i++;
  26. s[0]=s[i];
  27. s[i]='0';
  28. }
  29. cout << endl;
  30. for(int i =0;i<s.size();i++){
  31. cout << s[i];
  32. }
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement