fork(1) download
  1. #include <bits/stdc++.h>
  2. #define int long long
  3. using namespace std;
  4. string s;
  5. priority_queue<int>q;
  6. signed main(){
  7. cin>>s;
  8. int n=s.size();
  9. for(int i=0;i<n;i++){
  10. if(s[i]>='0' && s[i]<='9'){
  11. q.push(s[i]-'0');
  12. }
  13. }
  14. bool flag=false;
  15. while(!q.empty()){
  16. if(q.top()!=0){
  17. flag=true;
  18. }
  19. if(!flag && q.top()==0){
  20. cout<<0;
  21. return 0;
  22. }
  23. cout<<q.top();
  24. q.pop();
  25. }
  26. }
Success #stdin #stdout 0s 5300KB
stdin
0u050hz08t2ibm70y4exp04u6m44838cont753674e569zh6hpkxr9tyd0l1odacalb5u0a835e7631x9581dy8pnui496e7t0bx
stdout
99998888887777766666655555544444433332111000000000