Дана строка, содержащая от 2-х до 10-ти слов, в каждом из которых от 1-го до 8-ми строчных латинских букв. Между соседними словами не менее одного пробела, за последним словом точка. Напечатать те слова которые отличны от последнего слова и удовлетворяют следующему свойству: Буквы слова упорядочены по алфавиту. — Pascal(Паскаль)

uses crt;
var bol,sl,os,i,n,p:byte;
    s:string;
    stc: set of char;
begin
stc:=['a'..'z'];
clrscr;
write('Vvedite stroki: ');
readln(s);
s:=concat(' ',s);
for i:=1 to length(s) do
   begin
    if     (s[i]=' ') and (s[i-1]<>' ') then begin p:=0; inc(sl); end;
    if     (s[i] in stc)                then inc(p) else
    if not (s[i] in stc)                then inc(bol);
    if     (p>8)                        then os:=p;
   end;
if not (s[i] in ['.'])    then writeln ('Zabili tochku!');
if (sl>10) or (sl<2) then writeln ('Mnogo slov 2>',sl,'>10');
if (os>8)            then writeln ('Osibka ',os,'>8') else
if (bol>0)           then writeln ('Oshibka ',bol-1,': kolichestvo ne strochnix bukv');
readkey;
end.

Leave a Comment

15 + = 18