var c1,c2:char; s:string; m,l,i:integer; begin while true do begin readln(s); if s = '0 0 0' then break; l:=length(s); c2:=s[l]; c1:=s[l-2]; m:=length(s)-4; for i:=1 to m do begin If s[i]=c1 then s[i]:=c2; if (s[i] <> '0') or (i > 1) then write(s[i]); end; writeln; end; end.