【USACO题库】3.4.2 American Heritage美国血统

此题遍历即可。

var
        a,b:string;
        i:longint;
procedure dg(x,y:string);
var
        p,len:longint;
begin
        p:=pos(y[1],x);
        len:=length(x)-p;
        if p-1>0 then dg(copy(x,1,p-1),copy(y,2,p-1));
        if len>0 then dg(copy(x,p+1,len),copy(y,p+1,len));
        if y<>'' then write(y[1]);
end;
begin
        readln(a);
        readln(b);
        dg(a,b);
end.
转载需注明出处。
原文地址:https://www.cnblogs.com/jz929/p/11817717.html