UNIX Free Pascal




. - 5


Assign(f2,Paramstr(2));

Reset(f1);

Rewrite(f2);

StrBuf:='';

While Not(eof(f1)) do

begin

Readln(f1,TmpS);

TmpS:=StrBuf+TmpS;

n:=step;

if ord(Tmps[0])>step then

begin

While (not(TmpS[n]in [' ',',','(',')',';','.']))do if n>=1 then Dec(n) else Exit;

While (TmpS[n]in [' ',',','(',')',';','.'])do if n>=1 then Dec(n) else Exit;;

if n<1 then n:=Pos(',',TmpS);

Writeln(f2,Copy(TmpS,1,n));

StrBuf:=Copy(TmpS,n+1,Ord(TmpS[0])-n);

while Ord(strbuf[0])>step do

begin

if Pos(',',Strbuf)>Pos(' ',StrBuf) then

begin

Writeln(f2,Copy(StrBuf,1,Pos(',',StrBuf)));

Delete(StrBuf,1,Pos(',',StrBuf));

end

else

begin

Writeln(f2,Copy(StrBuf,1,Pos(' ',StrBuf)));

Delete(StrBuf,1,Pos(' ',StrBuf));

end

end;

end

else Writeln(f2,TmpS);

end;

Close(f1);

Close(f2);

end.

 

13.10. , , 60 .

Program Tabs;

var

f1,f2:Text;

sin:string;

i:Byte;

CheckSpaces:Boolean;

SetTab:Boolean;

begin

if ParamCount<2 then

begin

Writeln('Wrong parameters');

Writeln('Format: ./task <inputfile> <outputfile>');

Halt(1);

end;

Assign(f1,Paramstr(1));

Assign(f2,Paramstr(2));

Reset(f1);

Rewrite(f2);

While Not(eof(f1)) do

begin

Readln(f1,sin);

i:=1;

While (ord(sin[0])<60) do

begin

if Pos(' ',sin)=0 then sin:=' '+sin+' ';

if sin[i]=' ' then

begin

sin:=copy(sin,1,i)+' '+copy(sin,i+1,ord (sin[0])-i);

Inc(i);

end;

Inc(i);

if i>Ord(sin[0]) then i:=1;