procedure Solve(pre,mid:string); var i:integer; begin if (pre='''') or (mid='''') then exit; i:=pos(pre[1],mid); solve(copy(pre,2,i),copy(mid,1,i-1)); solve(copy(pre,i+1,length(pre)-i),copy(mid,i+1,length(mid)-i)); post:=post+pre[1]; {加上根,递归结束后post即为后序遍历} end;