прогу написал, вроде стабильная кому может пригодится.
Код | uses crt; var S:text; a:char; tmp,b:string; flag2,flag,l,i,j,n,c:integer; begin clrscr; assign(S, 'input.txt'); reset(S); b:=''; tmp:=''; writeln('‘Слова и фразы палиндромы:'); writeln; writeln; c:=0;
while not EOF(S) do begin read(S,a); n:=0; if (a<>';') and (a<>'.') then begin b:=b+a; if a<>' ' then tmp:=tmp+a; end;
if (a=';') or (a='.') then
begin l:=length(tmp);
for i:=l downto 1 do if tmp[i] = tmp[l-i+1] then inc(n);
if n=l then begin inc©; write©; write('- '); writeln(b); end;
b:=''; tmp:=''; end;
end; close(S); writeln; writeln;
if c=0 then writeln('не найдено...');
writeln; writeln; writeln('Нажмите enter...'); readln; end.
|
|