Răspuns :
Răspuns:
#include <iostream>
using namespace std;
int main()
{
int n, cif, v[10]={0}, dist=1;
cin >> n;
if (n==0)
{
v[0]=1; dist=1;
}
else
{
while (n)
{
cif=n%10;
++v[cif];
if (v[cif]>1) dist=0;
n=n/10;
}
}
if (dist==1)
{
cout << "DISTINCTE";
}
else
{
for (cif=0; cif<10; cif++)
{
if (v[cif]>0)
{
cout << cif << " " << v[cif] << endl;
}
}
}
return 0;
}
Explicație: