You are given two strings sentence1 and sentence2, each representing a sentence composed of words separated by single spaces.
Two sentences are considered similar if you can insert an arbitrary sequence of words (which may be empty) into one of the sentences such that the resulting sentence becomes identical to the other sentence. The inserted words must be separated from the surrounding words by spaces.
Return true if sentence1 and sentence2 are similar, or false otherwise.
Constraints:
sentence1.length, sentence2.length
sentence1 and sentence2 consist of lowercase and uppercase English letters and spaces.
The words in sentence1 and sentence2 are separated by a single space.
You are given two strings sentence1 and sentence2, each representing a sentence composed of words separated by single spaces.
Two sentences are considered similar if you can insert an arbitrary sequence of words (which may be empty) into one of the sentences such that the resulting sentence becomes identical to the other sentence. The inserted words must be separated from the surrounding words by spaces.
Return true if sentence1 and sentence2 are similar, or false otherwise.
Constraints:
sentence1.length, sentence2.length
sentence1 and sentence2 consist of lowercase and uppercase English letters and spaces.
The words in sentence1 and sentence2 are separated by a single space.