Pascal
Алгоритм1
var
s : string;
n1,n2 : integer;
i,l : integer;
begin
readln (s);
n1 := 0; n2 := 0;
l := Length(s);
for i := 1 to l do
if (s[i] = ' ') then
if n1 = 0 then
n1 := i
else
n2 := i;
if n2 = 0 then
s := ' '
else
s := copy(s,n1+1,n2-n1-1);
writeln (s);
end.
Алгоритм2
var
s : string;
n1,n2 : integer;
i,l : integer;
r : boolean;
begin
readln (s);
n1 := 0; n2 := 0;
r := false;
l := Length(s);
i := 1;
While (i<=l) and (not r) do <br>begin
if s[i] = ' ' then
begin
n1 := i;
r := true;
end;
i := i +1;
end;
r :=false;
i := l;
While (i>0) and (not r) do
begin
if s[i] = ' ' then
begin
n2 := i;
r := true;
end;
i := i -1;
end;
if n2 = n1 then
s := ' '
else
s := copy(s,n1+1,n2-n1-1);
writeln (s);
end.