Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int x,uc,cif0,cif1,cif2,cif3,cif4,cif5,cif6,cif7,cif8,cif9;
- int main()
- {
- cin>>x;
- while(x)
- {
- uc=x%10;
- if(uc==0)cif0++;
- if(uc==1)cif1++;
- if(uc==2)cif2++;
- if(uc==3)cif3++;
- if(uc==4)cif4++;
- if(uc==5)cif5++;
- if(uc==6)cif6++;
- if(uc==7)cif7++;
- if(uc==8)cif8++;
- if(uc==9)cif9++;
- x/=10;
- }
- while(cif9)
- {
- cout<<9;
- cif9--;
- }
- while(cif8)
- {
- cout<<8;
- cif8--;
- }
- while(cif7)
- {
- cout<<7;
- cif7--;
- }
- while(cif6)
- {
- cout<<6;
- cif6--;
- }
- while(cif5)
- {
- cout<<5;
- cif5--;
- }
- while(cif4)
- {
- cout<<4;
- cif4--;
- }
- while(cif3)
- {
- cout<<3;
- cif3--;
- }
- while(cif2)
- {
- cout<<2;
- cif2--;
- }
- while(cif1)
- {
- cout<<1;
- cif1--;
- }
- while(cif0)
- {
- cout<<0;
- cif0--;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement