Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- long x;
- cin>>x;
- int cif[10],poz[10],i,j,aux1,aux2;
- for (int i=0;i<10;i++)
- {
- poz[i]=i;
- cif[i]=0;
- }
- while (x)
- {
- cif[x%10]++;
- x/=10;
- }
- for (i=0;i<9;i++)
- for (j=i+1;j<=9;j++)
- if (cif[i]>cif[j])
- {
- aux1=cif[i];
- cif[i]=cif[j];
- cif[j]=aux1;
- aux2=poz[i];
- poz[i]=poz[j];
- poz[j]=aux2;
- }
- for (i=0;i<=9;i++)
- cout<<poz[i]<<' ';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement