Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int x,uc,cif0,cif1,cif2,cif3,cif4,cif5,cif6,cif7,cif8,cif9;
  4. int main()
  5. {
  6. cin>>x;
  7. while(x)
  8. {
  9. uc=x%10;
  10. if(uc==0)cif0++;
  11. if(uc==1)cif1++;
  12. if(uc==2)cif2++;
  13. if(uc==3)cif3++;
  14. if(uc==4)cif4++;
  15. if(uc==5)cif5++;
  16. if(uc==6)cif6++;
  17. if(uc==7)cif7++;
  18. if(uc==8)cif8++;
  19. if(uc==9)cif9++;
  20. x/=10;
  21. }
  22. while(cif9)
  23. {
  24. cout<<9;
  25. cif9--;
  26. }
  27. while(cif8)
  28. {
  29. cout<<8;
  30. cif8--;
  31. }
  32. while(cif7)
  33. {
  34. cout<<7;
  35. cif7--;
  36. }
  37. while(cif6)
  38. {
  39. cout<<6;
  40. cif6--;
  41. }
  42. while(cif5)
  43. {
  44. cout<<5;
  45. cif5--;
  46. }
  47. while(cif4)
  48. {
  49. cout<<4;
  50. cif4--;
  51. }
  52. while(cif3)
  53. {
  54. cout<<3;
  55. cif3--;
  56. }
  57. while(cif2)
  58. {
  59. cout<<2;
  60. cif2--;
  61. }
  62. while(cif1)
  63. {
  64. cout<<1;
  65. cif1--;
  66. }
  67. while(cif0)
  68. {
  69. cout<<0;
  70. cif0--;
  71. }
  72. return 0;
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement