Back to problems

Reverse Count and Say

Algorithm · Pinterest · Medium

You have an encoded string encoded that was generated by performing a single count-and-say operation on an original string of digits. In this encoding, each group of identical consecutive digits in the original is replaced by a count (which is one or two digits long) immediately followed by the digit itself. For instance, the original string "3322251" encodes to "23321511": the two "3"s become "23", the three "2"s become "32", the single "5" becomes "15", and the single "1"…

Checking your access…