|
|
back to boardWA 3 Please give me test №3. Re: WA 3 3th test is AbabaAab AbabaAababA !!!!!! I Use this solution and got AC var n,i,j,k,f,r:longint; s,s2:ansistring; el:char; function prov(f,n:longint):boolean; var i,j:longint; begin prov:=true; i:=f+1; j:=n-1; while i<j do begin if s[i]<>s[j] then begin prov:=false; exit; end; i:=i+1; j:=j-1; end; end; begin readln(s); write(s); n:=length(s); if n=1 then begin write(s[1]); halt; end; el:=s[n]; if prov(1,n) then r:=1; for f:=2 to (n-r) do if s[f]=el then if prov(f,n) then begin for i:=(f-1) downto 1 do write(s[i]); Halt; end; i:=n-1; s:=s+s[i]; n:=n+1; write(s[n]); while not prov(1,n) do begin i:=i-1; s:=s+s[i]; n:=n+1; write(s[n]); end; halt; end. Edited by author 09.11.2007 13:00 |
|
|