Uses crt; Const maxlenghtstring=999; Var S: Array [1..maxlenghtstring] of String[1]; i,j,t,Code: Word; FileSize,L,Price_l:LongInt; F,F1,F2,F3: Text; q,temp,newS:String; ctr,val_kop,val_grn,val_krb,val_rub,v902:String; Date: Array [1..12] of String; Begin Clrscr; Assign(F, 'info.txt'); Reset(F); For i:=1 To 12 Do ReadLn(F,Date[i]); ReadLn(F,ctr); ReadLn(F,val_kop); ReadLn(F,val_grn); ReadLn(F,val_krb); ReadLn(F,val_rub); Read(F,v902); Close(F); FileSize:=1; Assign(F, '111.txt'); Reset(F); While Not EOF(F) Do Begin ReadLn(F); Inc(FileSize) end; Close(F); Price_l:=FileSize div 100; if Price_l=0 then Price_l:=1; For i:=1 to maxlenghtstring do S[i]:=''; Assign(F, '111.txt'); Reset(F); Assign(F1, '222.txt'); Rewrite(F1); { Assign(F2, '333.txt'); Rewrite(F2); Assign(F3, '444.txt'); Rewrite(F3); } L:=1; While Not EOF(F) Do Begin i:=1; While Not EOLn(F) Do begin Read(F, S[i]); Inc(i) end; q:=''; if i<255 then for j:=1 to i do q:=q+S[j]; temp:=''; if i>7 then for j:=1 to 6 do temp:=temp+S[j] else if i=6 then WriteLn(F1,v902); if S[i]='^' then S[i]:=''; if temp='#225: ' then begin ReadLn(F); i:=1; While Not EOLn(F) Do begin Read(F, S[i]); i:=i+1 end; temp:=''; if i>7 then for j:=1 to 6 do temp:=temp+S[j]; end; if temp='#700: ' then begin t:=0; for j:=7 to i do if S[j]=' ' then t:=1; if t=1 then begin j:=9; t:=0; temp:=temp+'^A'; while S[j]<>' ' do begin temp:=temp+S[j]; j:=j+1 end; temp:=temp+'^B'; for t:=j+1 to i do temp:=temp+S[t]; if copy(temp,i-2,3)='^L1' then delete(temp,i-2,3); i:=length(temp); for j:=1 to i do S[j]:=temp[j] end; newS:=''; for j:=1 to i do newS:=newS+S[j]; if Copy(newS,i-3+t,3)='^L1' then begin Delete(newS,i-2,3); i:=length(newS); for j:=1 to i do S[j]:=newS[j] end; end; if temp='#606: ' then begin newS:=''; for j:=4 downto 1 do newS:=newS+S[i-j]; if newS='^C^D' then begin for j:=i-4 to i do S[j]:=''; i:=i-4 end; newS:=''; for j:=i-5 to i do newS:=newS+S[j]; if newS='^C^D0' then begin for j:=i-5 to i do S[j]:=''; i:=i-5 end; t:=0; for j:=7 to i do if S[j]=' ' then t:=1; Val(S[9],j,Code); if (code=0) and (t=1) then begin j:=9; t:=0; while S[j]<>' ' do begin temp:=temp+S[j]; j:=j+1 end; temp:=temp+'^B'; newS:=''; for t:=j+1 to i do newS:=newS+S[t]; temp:=temp+newS; insert('#606: ^A',newS,1); WriteLn(F1,newS); delete(temp,2,3); insert('621',temp,2); i:=length(temp); for j:=1 to i do S[j]:=temp[j]; end; j:=7; while (S[j]<>'2') and (j'^') and (S[j+3]<>'.') then begin newS:=''; for t:=1 to j-2 do newS:=newS+S[t]; Code:=0; for t:=1 to 12 do if newS=Date[t] then Code:=t; if Code=0 then begin For t:=1 to i do Write(F1,S[t]); WriteLn(F1); { For t:=1 to i do Write(F2,S[t]); WriteLn(F2);} newS:='#907: ^C^A200'+S[j+3]+'0101^B'; i:=length(newS); for j:=1 to i do S[j]:=newS[j]; { For j:=1 to i do Write(F3,S[j]); WriteLn(F3)} end else begin Str(Code,temp); if Code<10 then temp:='0'+temp; newS:='#907: ^CZU^A200'+S[j+3]+temp+'01'; i:=length(newS); for j:=1 to i do S[j]:=newS[j] end end end; if temp='#907: ' then begin j:=7; while (j'1') and (S[j]<>'2') do j:=j+1; newS:='#907: ^C^A'; for t:=j to j+7 do newS:=newS+S[t]; newS:=newS+'^B'; i:=length(newS); for j:=1 to i do S[j]:=newS[j] end; if temp='#900: ' then begin newS:='#900: '; for j:=9 to 12 do newS:=newS+S[j]; for j:=1 to i do S[j]:=''; for j:=1 to 10 do S[j]:=newS[j] end; if temp='#919: ' then begin j:=7; newS:='#919: '; while S[j]<>' ' do begin newS:=newS+S[j]; j:=j+1 end; for j:=1 to i do S[j]:=''; i:=length(newS); for j:=1 to i do S[j]:=newS[j] end; if temp='#215: ' then begin newS:=''; for j:=1 to i do newS:=newS+S[j]; for j:=1 to i do S[j]:=''; if Copy(newS,i-8,8)='^C^0^7^8' then Delete(newS,i-8,8); i:=length(newS); code:=0; j:=9; while code=0 do begin Val(newS[j],t,Code); inc(j) end; Delete(newS,j-1,i-j+2); newS:=newS+'^1'+ctr+'.'; i:=length(newS); for j:=1 to i do S[j]:=newS[j] end; If (temp='#10: ^') then Begin newS:=''; for j:=1 to i do begin newS:=newS+S[j]; S[j]:='' end; if (Copy(newS,i-6,6)='00'+val_kop+'.') or (Copy(newS,i-6,6)='00'+val_kop+',') then Delete(newS,i-6,6); if Copy(newS,i-5,5)='00'+val_kop then Delete(newS,i-5,5); if (Copy(newS,i-7,7)='00 '+val_kop+'.') or (Copy(newS,i-7,7)='00 '+val_kop+',') then Delete(newS,i-7,7); if Copy(newS,i-6,6)='00 '+val_kop then Delete(newS,i-6,6); code:=0; j:=7; t:=0; repeat inc(j); Val(newS[j],t,Code) until code=0; if j>8 then Delete(newS,8,j-8); j:=7; while code=0 do begin inc(j); Val(newS[j],t,Code) end; i:=length(newS); { q:=Copy(newS,j,i-j);} if Copy(newS,j,3)=val_grn then Insert('^C',newS,j); if Copy(newS,j,3)=val_kop then begin Delete(newS,j,i-j+1); Insert('0.',newS,8); newS:=newS+'^C'+val_grn+'.' end; if Copy(newS,j,3)=val_krb then Insert('^C',newS,j); if newS[j]=val_rub[1] then begin Delete(newS,j,i-j+1); newS:=newS+'^C'+val_rub+'.' end; i:=length(newS); if i>8 then for j:=1 to i do S[j]:=newS[j] else temp:='#922: ' End; If (temp<>'#922: ') and (copy(temp,1,3)<>'#1:') then Begin For j:=1 to i do Write(F1,S[j]); WriteLn(F1); End; For j:=1 to i do S[j]:=''; If Not EOF(F) then ReadLn(F); L:=L+1; If l mod Price_l=0 then begin GoToXY(38,13); Write(L/FileSize*100:3:0,'%') end; End; { Close(F3); Close(F2); } Close(F1); Close(F); End.