I have a set (integer) of input values and a set of expected values, e.g.

000033335502200008777 000033335552200007777

in this sample I have zero input, that should be ignored and groups of non-zero input:

3333 555 22 7777

input data could have

- different length of group (550 and 555)
- group shift (0055500 0555000)
- wrong (but close) values (8777 and 7777)

for each such group I would like to have matching ratio like this:

3333 (100%) 555 (66.67%) 22 (100%) 7777 (75%)

Important point is that I need this ratio right after the processing of each group is finished:

first ratio after 8 values second ratio after 11 values third ratio after 13 values fourth ratio after 21 values

**What algorithm/approach should I choose?**

Thank you in advance!