Back to problems

Check if an Original String Exists Given Two Encoded Strings

Algorithm · Snowflake · Hard

You are given two strings s1 and s2. Each string is an encoding of some original string that consists entirely of lowercase English letters ('a'–'z'). The encoding works as follows: Any non-empty contiguous substring of the original string may be replaced by its length (a single digit '1'–'9'). Digits in the encoded string represent the lengths of hidden segments. A group of consecutive digits may be interpreted as a single multi-digit number (e.g., "12" means a hidden…

Checking your access…