#include <iostream>
using namespace std;
int main()
{
int a,b,x[9],y[9],r,c=0,i;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
for(i=0;i<=9;i++)
{
x[i]=0;
y[i]=0;
}
while(a)
{
r=a%10;
x[r]=1;
a=a/10;
}
while(b)
{
r=b%10;
y[r]=1;
b=b/10;
}
cout<<"Cifre comune: ";
for(i=0;i<=9;i++)
{
if(x[i]!=0 && y[i]!=0)
{
cout<<i<<" ";
c=1;
}
}
if(c==0) cout<<"Nu exista!\n";
return 0;
}