program p46;
var
s:string;
dir,a,a1,a2,kg:char;
k,i:longint;
begin
assign(input,'edit.in');
assign(output,'edit.out');
reset(input);
rewrite(output);
readln(s);
read(dir);
k:=0;
if dir='D' then
begin
read(kg,a);
k:=pos(a,s);
if k=0 then writeln('error')
else delete(s,k,1);
writeln(s);
end;
if dir='I' then
begin
read(kg,a1,kg,a2);
for i:=1 to length(s) do
if s[i]=a1 then k:=i;
if k=0 then writeln('error')
else insert(a2,s,k);
writeln(s);
end;
if dir='R' then
begin
read(kg,a1,kg,a2);
for i:=1 to length(s) do
if s[i]=a1 then begin s[i]:=a2; k:=1; end;
if k=0 then writeln('error')
else writeln(s);
end;
close(input);
close(output);
end.