var U:string; X:word; Oddel:char; Z:byte; PocetZnaku: Boolean; prom:string; function Vypis(C: word; R: byte): string; const P: array [0..15] of char = '0123456789ABCDEF'; var pom: string; begin pom:=''; while C>0 do begin pom:=P[C mod R] + pom; C:=C div R end; if R=16 then Vypis:='0x'+pom else Vypis:=pom; end; function FileExists(Jm:string): boolean; var F:text; begin Assign(F, Jm); {$I-} reset(F); {$I+} FileExists:=IOResult=0; end; procedure NastavPar(Jm: string); var F:text; Radek,id,value:string; Rov:byte; begin Assign(F,Jm); reset(F); while not eof(F) do begin readln(F,Radek); Rov:=Pos('=',Radek); id:=Copy(Radek,1,Rov-1); value:=Copy(Radek,Rov+1,255); if id='oddel' then Oddel:=value[1]; if id='zaklad' then Val(value,Z); if id='znaku' then PocetZnaku:=value='true'; end; Close(F); end; begin X:=0; {------- nastaveni pocatecnich hodnot ------- } Oddel:=':'; Z:=10; PocetZnaku:=false; {-------- nastaveni z konf. souboru ------} if FileExists('cislujrc') then NastavPar('cislujrc'); {-------- nastaveni z promennych prostredi ------} { prom:=GetEnv('Oddel'); if prom<>'' then oddel:=prom[1];} {-------- nastaveni z prikazoveho radku ------} if ParamCount>0 then begin prom:=ParamStr(1); oddel:=prom[7]; end; while not eof do begin readln(U); if PocetZnaku then inc(X,Length(U)) else inc(X); writeln(Vypis(X,Z),Oddel, U) end end.