|
|
back to boardHELP!!! WA4!! {Why?} var S: string; ns: String; i: integer; j: integer; function Palindrom(st: string): boolean; var i: integer; b: boolean; begin b:=true; i:=1; while (i<=length(s) div 2) and b do begin if st[i]<>st[length(st)-i+1] then b:=false; inc(i); end; Palindrom:=b; end; function Revert(st: string): string; var temp: string; i: integer; begin temp:=''; for i:=length(st) downto 1 do temp:=temp+st[i]; revert:=temp; end; begin readln(s); i:=0; for j:=length(s)-2 downto 1 do if palindrom(Copy(s,j,length(s)-j+1)) then i:=j; if i=0 then begin ns:=Revert(Copy(s,1,length(s)-1)); writeln(s+ns); end else if i=1 then writeln(s+Copy(s,2,length(s)-1)) else begin ns:=Revert(Copy(s,1,i-1)); writeln(s+ns); end; end. Re: HELP!!! WA4!! 111 answer: 1111 do this massiv (read char) |
|
|