还是字符串处理: { Author:wzx961008 Problem:UVa 10361-Automatic Poetry Verdict:Accepted Language:PASCAL Run Time:0.008s Submission Date:2011-01-12 06:41:09 } var i,j,n,top:longint; s1,s2,s3:string; word:array[1..5]of string; begin readln(n); for i:=1 to n do begin readln(s1); readln(s2); top:=1; for j:=1 to 5 do word[j]:=''; for j:=1 to length(s1) do if (s1[j]<>'<')and(s1[j]<>'>') then word[top]:=word[top]+s1[j] else inc(top); for j:=1 to 5 do write(word[j]); writeln; delete(s2,length(s2)-2,3); writeln(s2+word[4]+word[3]+word[2]+word[5]); end; end.