VAR
S,S1,S2:String;
i,i1,i2,N,j:Byte;
f:text;
BEGIN
assign(f,'путь к файлу');
{
ReadLn(S);
WriteLn;
N:=0;
i:=0;
Repeat
Repeat
Inc(i);
Until S[i]<>' ';
i1:=i;
Repeat
Inc(i);
Until (S[i]=' ') or (i=Length(S));
If S[i]=' ' then i2:=i else i2:=i+1;
S1:=Copy(S,i1,(i2-i1));
S2:=S1;
For j:=1 to Length(S1) do
S2[Length(S1)-j+1]:=S1[j];
If S1=S2 then
begin
Write(S1+' ');
Inc(N);
end;
Until i=Length(S);
WriteLn;
WriteLn(N,' words');
ReadLn;
}
close(f);
END.