Check if a String Is a Valid Shuffle
Given two strings and a third, determine if the third is a valid interleaving shuffle of the first two.
Input format
Three lines with lowercase strings A, B, and C.
Output format
Print true if C is an interleaving of A and B that preserves the character order of each, otherwise false.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
abc def adbecfExpected output
trueExample 2
Input
ab cd acdbExpected output
true