Răspuns:
#include <iostream>
using namespace std;
int main()
{
int c, n, nr = 0, p = 1;
cin >> n >> c;
while(n)
{
if(n % 10 != c)
{
nr = nr + (n % 10) * p;
p = p * 10;
}
n /= 10;
}
if(nr == 0)
{
if(p == 1) cout << -1;
else cout << nr;
}
else cout << nr;
}