ValerianBenchea

Problema

Mar 5th, 2020
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int f[10];
  5. int main()
  6. {
  7.     int n, i=0, j;
  8.     cin>>n;
  9.     while(n)
  10.     {
  11.         f[n%10]++;
  12.         n/=10;
  13.     }
  14.     for(i=9; i>=0; i--)
  15.     {
  16.         for(j=1; j<=f[i]; j++)
  17.             cout<<i;
  18.     }
  19.     cout<<"\n";
  20.     for(i=9; i>=0; i--)
  21.     {
  22.         if(f[i])
  23.             cout<<i;
  24.     }
  25.  
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment