#include <stdio.h>


void	ft_ft(int x,int y, int z)
{
	if (x != 0)
{
	ft_ft(x/10, y, z);
	if (x % 10 == y)
		{
			if (z == 0 && x / 10 !=0 || z!= 0)
				printf("%d", z);
		}
	else
		printf("%d", x % 10);
	}	
}

int main()
{
	int x, y, z, x1, y1, z1;
	x = y = z = x1 = z1 = y1  =1;
	while (x1 != 0 || y1 != 0 || z1 != 0)
	{
		scanf("%d %d %d", &x, &y, &z);
		x1 =  x; y1 = y; z1 = z;
			ft_ft(x, y ,z);
		if (x1 != 0 || y1 != 0 || z1 != 0)
		printf("\n");
	}
return (0);
}