Can someone correct this and add needed
program palindrom;
var
a:array[1..57] of char;
b:array[1..90] of char;
rec:array[1..1000] of char;
e,f,g:array[1..500] of string;
i,j,n,o:longint;
k,l,m:integer;
c:boolean;
d:string;
begin
repeat
i:=i+1;
read(rec[i]);
until(eoln);
m:=i;
for i:=48 to 57 do
a[i-47]:=chr(i);
for i:=65 to 90 do
b[i-64]:=chr(i);
for i:=1 to m do begin
c:=false;
for j:=1 to 11 do
if rec[i]=a[j] then
c:=true;
for k:=1 to 26 do
if upcase(rec[i])=b[k] then
c:=true;
if c=true then d:=d+rec[i] else d:=d+' ';
end;
i:=1;
j:=0;
k:=0;
repeat
j:=j+1;
if d[j]=' ' then i:=i+1;
f[i]:='';
e[i]:=e[i]+d[j];
for o:=1 to length(e[i]) do begin
if e[i,o]<>' ' then g[i]:=g[i]+d[j];
end;
for n:=length(g[i]) downto 1 do
f[i]:=f[i]+g[i,n];
if g[i]=f[i] then k:=k+1;
until j=length(d);
writeln(k);
end.
program palindrom;
var
a:array[1..57] of char;
b:array[1..90] of char;
rec:array[1..1000] of char;
e,f,g:array[1..500] of string;
i,j,n,o:longint;
k,l,m:integer;
c:boolean;
d:string;
begin
repeat
i:=i+1;
read(rec[i]);
until(eoln);
m:=i;
for i:=48 to 57 do
a[i-47]:=chr(i);
for i:=65 to 90 do
b[i-64]:=chr(i);
for i:=1 to m do begin
c:=false;
for j:=1 to 11 do
if rec[i]=a[j] then
c:=true;
for k:=1 to 26 do
if upcase(rec[i])=b[k] then
c:=true;
if c=true then d:=d+rec[i] else d:=d+' ';
end;
i:=1;
j:=0;
k:=0;
repeat
j:=j+1;
if d[j]=' ' then i:=i+1;
f[i]:='';
e[i]:=e[i]+d[j];
for o:=1 to length(e[i]) do begin
if e[i,o]<>' ' then g[i]:=g[i]+d[j];
end;
for n:=length(g[i]) downto 1 do
f[i]:=f[i]+g[i,n];
if g[i]=f[i] then k:=k+1;
until j=length(d);
writeln(k);
end.