ZIP is an archive file format that supports lossless data compression. There are many way to zip compress data nowadays, such as RLE, LZW,Huffman Coding ans so on, Today your friend think out a method similiar as RLE(run length encoding) to compress data.
The zip way purpose by your friend:
Given the sequence contain only English letter or digit, the runs of data(sequences in which the same data value occurs in many consecutive data elements) will be store as a single data value and count, rather than as the original run.
Take squence aaabbb444 for example, aaabbb444 can be encoded to 3a3b3'4' and the compress rate is 8/9 = 0.89
He ask you to help him implement the zip algoithm program and analysis the compress rate of the method. As the best friend of you, you decided to try your best to finish the progeam.
Note : Fix time complexity problem modified by 2019/10/12
S_1
S_2
...
S_N
Given the sequence contain only English letter or digit.
(2 <= the length of each sequence < 1000, and the input testcases are less than 1000)
Note that: the sequence is case-sensitive and the testcase is end of EOF character.
Print out the zip string and the compression rate, each line followed by a newline character. (If the compression rate less than 1.0 then print out "compress rate:6.3f" with the result, otherwise print out "the string can't zip")
Note that : Using float not double.