简单字符串处理: { Author:wzx961008 Problem:UVa 401-Palindromes Verdict:Accepted Language:PASCAL Run Time:0.024s Submission Date:2011-01-12 01:05:27 } const mirrorchar1:string='ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789'; mirrorchar2:string='A 3 HIL JM O 2TUVWXY51SE Z 8 '; var s,s1:string; i:longint; ifpalindrome,ifmirror:boolean; function mirror(c1,c2:char):boolean; begin if pos(c1,mirrorchar1)=pos(c2,mirrorchar2) then exit(true); mirror:=false; end; begin while not eof do begin readln(s); s1:=''; for i:=1 to length(s) do s1:=s[i]+s1; ifpalindrome:=false; if s1=s then ifpalindrome:=true; ifmirror:=true; for i:=1 to length(s) do ifmirror:=ifmirror and mirror(s[i],s1[i]); if (ifpalindrome)and(ifmirror) then writeln(s,' -- is a mirrored palindrome.') else if ifpalindrome then writeln(s,' -- is a regular palindrome.') else if ifmirror then writeln(s,' -- is a mirrored string.') else writeln(s,' -- is not a palindrome.'); writeln; end; end.