Цитата:
Сообщение от yulia90
В Pascal'e,мальчики помогите)
|
Да ладно, без проблем:
Код:
VAR
S,Dummy:String;
i,j,Nw,i1,i2:Byte;
W:Array[1..128] of String;
BEGIN
WriteLn('Enter the string:');
ReadLn(S);
i:=0;
Nw:=0;
Repeat
Repeat
Inc(i);
Until S[i]<>' ';
i1:=i;
While (S[i]<>' ') and (i<Length(S)) do
Inc(i);
If i=Length(S) then i2:=i else i2:=i-1;
Inc(Nw);
W[Nw]:=Copy(S,i1,i2-i1+1);
Until i=Length(S);
For i:=1 to Nw-1 do
For j:=1 to Nw-i do
If Length(W[j])<Length(W[j+1]) then
begin
Dummy:=W[j];
W[j]:=W[j+1];
W[j+1]:=Dummy;
end;
For i:=1 to Nw-1 do Write(W[i]+' ');
WriteLn(W[Nw]);
ReadLn;
END.