USES CRT;
const max=100;
var x,y:string[2+max];
fx:array[-1..100,-1..100] of integer;
m,n,i,j:integer;
f:text;
function min(a,b,c:integer):integer;
var t:integer;
begin
if a<b then t:=a else t:=b;
if t>c then t:=c;
min:=t;
end;
procedure truyhoi;
var i,j:integer;
begin
for i := 0 to m do Fx[i, -1] := max + 1;
for j := 0 to n do Fx[-1, j] := max + 1;
for j := 0 to n do Fx[0, j] := j;
for i := 0 to m do Fx[i, 0] := i;
for i := 1 to m do
for j := 1 to n do
if X = Y[j] then Fx[i, j] := Fx[i - 1, j - 1]
else Fx[i, j] := Min(Fx[i, j - 1], fx[i - 1, j - 1], Fx[i - 1, j]) + 1;
end;
procedure truyvet;
begin
writeln(fx[m,n]);
while (m<>0) or (n<>0) do
if x[m]=y[n] then
begin dec(m);dec(n);end else
begin
write(x,'->');
if fx[m,n]=fx[m,n-1]+1 then
begin
write('insert(',m,',',y[n],')');
insert(y[n],x,m+1); dec(n);
end else
if fx[m,n]=fx[m-1,n-1]+1 then
begin
write('replace(',m,',',y[n],')');
x[m]:=y[n]; dec(m);
end else
if fx[m-1,n]+1=fx[m,n] then
begin
write('delete(',m,')');
delete(x,m,1);
dec(m);
end;
writeln('->',x);
end;
end;
begin
CLRSCR;
assign(f,'chuoiqud.inp');
reset(f);
read(f,x,y);
m:=length(x);
n:=length(y);
truyhoi;
truyvet;
readln;
end.