Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // ol
- //
- // Created by Roman L. on 26/02/2017.
- // Copyright © 2017 Roman L. All rights reserved.
- //
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main(int argc, const char * argv[]) {
- string s;
- cin >> s;
- sort(s.begin(), s.end());
- int i=s.size()-1;
- while(i>=0){
- cout << s[i];
- i--;
- }
- if(s[0]=='0'){
- i = 0;
- while(s[i]=='0') i++;
- s[0]=s[i];
- s[i]='0';
- }
- cout << endl;
- for(int i =0;i<s.size();i++){
- cout << s[i];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement