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 1297. Palindrome

Can you give me test data&//В чем дело? Пролетает то на первом, то на втором тестах. Хотя дома проверку проходит. Можете ли дать мне данные для проверки?
Posted by Evgeniy_Rus 19 May 2014 01:07
var
a:array[1..1000] of string;
S, pol:string;
N, i, j, dlina:longint;
function Sum(i, j:integer):string;
var k:string;
var i1:integer;
begin
k:='';
for i1:= i to j do
k:=k+a[i1];
Sum:=k;
end;
function Sum1(i, j:integer):string;
var k:string;
var i1:integer;
begin
k:='';
for i1:= j downto i do
k:=k+a[i1];
Sum1:=k;
end;
begin
readln(S);
N:=length(S);
for i:= 1 to N do
a[i]:=copy(lowercase(S), i, 1);
dlina:=0;
for i:= 1 to N-1 do
begin
for j:= i+1 to N do
if (Sum(i, j)=Sum1(i, j)) and (length(sum(i, j))>dlina) then
begin
pol:=Sum(i, j);
dlina:= length(sum(i, j));
end;
end;
writeln(pol);
end.