Compression |
There are many various compression method with character string compression among them. It is usually used for text compression, especially for program source codes. Source code usually consists of repeating identifiers and keywords. A simple compression method exchanges these repeating words with their codes.
Your task is to write a compression program using a below-defined method:
Example: identifier 'integer' from the source code listed below is given a code &(3+15) = &18 because 'var' is a keyword and 'n' is too short to be coded, so both are not counted.
program Test; var n :integer; function harmonic(number :integer):real; var i :integer; result :real; begin result := 0; for i := 1 to number do begin number := number + 1/i; end; harmonic := result; end; begin writeln('Get n:'); readln(n); writeln('harmonic number for n: '); writeln(harmonic(n)); end.
program Test; \&0 n :integer; \&14 harmonic(number :\&18):real; \&0 i :\&18; result :\&21; \&10 \&22 := 0; \&2 i := 1 to \&20 do \&10 \&20 := \&20 + 1/i; \&1; \&19 := \&22; \&1; \&10 writeln('Get n:'); readln(n); \&23('\&19 \&20 \&2 n: '); \&23(\&19(n)); \&1.