ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1354. Palindrome. Again Palindrome

Виктор Крупко Wrong answer test(4) Help me+++++ give some test+++++ [5] // Problem 1354. Palindrome. Again Palindrome 10 Apr 2005 00:52
program de;
    var
    s:string;
    i,j,l,z,ost:integer;
    q:boolean;
    mas:array[1..20000] of char;
begin
   readln(s);
   l:=length(s);
   for i:=1 to l do
   mas[i]:=s[i];
   if l=1 then writeln(mas[i]) else
   if (l=2) and (mas[1]=mas[2]) then writeln(mas[1],'',mas[2])
   else
   begin
   q:=true;
   for i:=1 to l div 2 do
   if mas[i]<>mas[l-i+1] then q:=false;
   if q then
     begin
     for i:=1 to l do
     write(mas[i]);
     end
   else
   begin
   for i:=l div 2 to l do
   begin
   q:=true;
   z:=0;
   ost:=0;
   while z+i<>l do
   begin
   inc(z);
   if mas[i-z+1]<>mas[i+z] then q:=false;
   end;
   if q then ost:=1;
   z:=0;
   if q<>true then
   begin
   q:=true;
   while z+i<>l do
   begin
   inc(z);
   if mas[i-z]<>mas[i+z] then q:=false;
   end;
   end;
   if q then
    begin
     for j:=1 to i do
     write(mas[j]);
     if i<>l then i:=i+ost;
     for j:=i-1 downto 1 do
     write(mas[j]);
     break;
    end;
   end;
   end;
   end;
   readln;
end.
Da ti idiot, blia!!
var s1,s2:array[1..10000] of char;
    i,j,k,n,g,h:integer;
    noans:boolean;
    ch : char;
begin
read(ch);
while ch in ['a'..'z','A'..'Z','0'..'9'] do begin
inc(i);
s1[i]:=ch;
read(ch);
end;
n:=i;
if n=0 then writeln(' ');
if n=1 then writeln(s1[1],s1[1]);
if n>1 then begin

for j:=2 to n do
begin
noans:=true;
h:=n;
if s1[j]=s1[n] then begin
noans:=false;
for k:=j to ((n-j) div 2)+j-1 do begin
if s1[k]=s1[h] then
h:=h-1
else begin
noans:=true;
break;
end; end;
end;
if not noans then begin
for i:=1 to n do
write(s1[i]);
for g:=(j-1) downto 1 do
write(s1[g]);
halt;
end;
end;
end;
end.
butcherFac you xitro viebannii 4to-li.
Tebe cpokoino ne givetcia.
Tebia B realnoi gizni 4asto obigaut.
Po4emy B tebe stolko zlosti???????