Tap here to switch tabs
Problem
Submissions

Problem: Check if an Original String Exists From Two Encodings

Try to solve the Check if an Original String Exists Given Two Encoded Strings problem.

Statement

An original string containing only lowercase English letters can be encoded using the following process:

  1. Partition the string into a sequence of non empty substrings.

  2. Replace any arbitrary number of these substrings with their respective lengths.

  3. Concatenate the remaining substrings and length values in their original order.

Given two encoded strings s1 and s2, return true if there exists an original string that can be encoded into both s1 and s2, or false otherwise.

Constraints:

  • 1≤1 \leq s1.length, s2.length ≤40\leq 40

  • s1 and s2 consist of digits 11 through 99 inclusive and lowercase English letters only.

  • The number of consecutive digits in s1 and s2 does not exceed 33.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check if an Original String Exists From Two Encodings

Try to solve the Check if an Original String Exists Given Two Encoded Strings problem.

Statement

An original string containing only lowercase English letters can be encoded using the following process:

  1. Partition the string into a sequence of non empty substrings.

  2. Replace any arbitrary number of these substrings with their respective lengths.

  3. Concatenate the remaining substrings and length values in their original order.

Given two encoded strings s1 and s2, return true if there exists an original string that can be encoded into both s1 and s2, or false otherwise.

Constraints:

  • 1≤1 \leq s1.length, s2.length ≤40\leq 40

  • s1 and s2 consist of digits 11 through 99 inclusive and lowercase English letters only.

  • The number of consecutive digits in s1 and s2 does not exceed 33.