Code: Select all
while(scanf(" %c %s", &c, num) == 2)
{
if (c=='0' && !strcmp(num,"0")) break;
Moderator: Board moderators
Code: Select all
while(scanf(" %c %s", &c, num) == 2)
{
if (c=='0' && !strcmp(num,"0")) break;
Code: Select all
#include <iostream>
using namespace std;
int main()
{
long long int a,b,i,add,sep,mul;
while(cin>>a>>b)
{
if(a==0 && b==0)
break;
mul=1;
add=0;
for(i=b;i!=0;i/=10)
{
sep=i%10;
if(sep!=a)
{
add=(sep*mul)+add;
mul*=10;
}
}
cout<<add<<endl;
}
return 0;
}
Second integer can be 10^100. long long is not enough, it handles only 19-20 digits. Use string.Each line contains two integers D and N ( 1<= D <= 9 and 1 <= N < 10^100 )