An RLE compressed number is uncompressed as follows. Replace each occurrence of the substring "[k]c" (quotes for clarity), where k is a positive integer without leading zeroes and c is a single digit, with k consecutive occurrences of c. For example, "12[3]3[2]4[5]1" uncompresses to "123334411111". "123[2]3441[3]11" uncompresses to the same number.
Note that uncompression is not recursive; brackets are not allowed to be nested.
You are given two RLE compressed numbers a and b and String[] k. Uncompress a and b, and add them together. Return a int[], the i-th element of which is the k[i]-th digit of the sum. The 0-th digit is the rightmost digit, the 1-st digit is the next digit to the left, etc. If there are not enough digits, the corresponding element must be equal to 0.
|