Pagini recente » Cod sursa (job #1633409) | Cod sursa (job #1589715) | Cod sursa (job #352913) | Cod sursa (job #1419957) | Cod sursa (job #75189)
Cod sursa(job #75189)
program SlowPalin;
const
inp = 'pscpld.in';
out = 'pscpld.out';
maxn = 1000000;
var
a : array[1..maxn] of char;
i, l, n : integer;
ans : longint;
function Check(st, ed : integer) : integer;
begin
while (st < ed) and (a[st] = a[ed]) do begin
st += 1;
ed -= 1;
end;
if (ed <= st) then Check := 1
else Check := 0;
end;
BEGIN
assign(input, inp); reset(input);
assign(output, out); rewrite(output);
n := 0;
while not EOLN do begin
n += 1;
read(a[n]);
end;
ans := 0;
for i := 1 to n do
for l := 1 to n - i + 1 do
ans += Check(i, i + l - 1);
writeln(ans);
close(input); close(output);
END.