program prakt_7;
uses crt;
procedure short(var s:string; var word:string; var g:byte);
var
min:string;
i,j:byte;
begin
j:=255;word:='';
s:=s+' ';
for i:=1 to length(s) do
if (s[i]<>' ') and (s[i]<>'.') then
word:=word+s[i]
else if (s[i]=' ') and (s[i+1]<>' ') then begin
if length(word)<j then begin
min:=word; j:=length(min);
end;
word:='';
if s[i]='.' then break;
end;
word:=min;
end;
var
s,s1,s2,word,sk:string;
i,prob,len,k,g,h:byte;
BEGIN
{clrscr;}
repeat
writeln('Enter String(Otdelyaemaya probelami i konech tochkoy)');
readln(s);
until s[length(s)]='.';
for i:=1 to length(s) do
if s[i]=' ' then inc(prob);
if (length(s)=1) and (s[length(s)]='.') then writeln('Pustaya stroka[The End].')
else
if prob=length(s)-1 then writeln ('Stroka soderjit odni probeli [The End.]')
else
begin
i:=0;
{repeat
inc(i);
if s[i]=' ' then delete(s,i,1);
until s[i]<>' ';}
short(s,word,g);
if length(word)=1 then
begin
writeln('Slovo: ', word);
writeln('Ne mojet bit razdeleno!');
end
else
begin
h:=length(word);
writeln('The most shortes word - " ',word,' " his length = ',length(word));
if odd(length(word)) then delete(word,length(word) div 2+1,1);
s1:=' ';
insert(s1,word,length(word) div 2+1);
writeln(word);
writeln(s);
readln;
end;
end;
END.