Найти самое короткое слово в тексте. Считать, что слова в тексте отделены друг от друга одним пробелом — Pascal(Паскаль)

uses
  crt;
const
  dividers = [' ',',','.',';',':','-','=','+'];
var
  s,temp,min:string;
  i:integer;
begin
  ClrScr;
  ReadLn(s);
  temp:='';
  min:=s;
  for i:=1 to Length(s) do
  begin
    if not (s[i] in dividers) then
      temp:=temp+s[i];
    if ((s[i] in dividers) or (i=Length(s))) and (temp<>'') then
    begin
      if Length(temp)<Length(min) then
        min:=temp;
      temp:='';
    end
  end;
  writeln('Itog: ',min)
end.

Leave a Comment

42 + = 47