Two strings woven into a third
Given three strings a, b and c, return True if c can be woven from a and b: it uses every character of both exactly once, the characters taken from a keep a's order, and those taken from b keep b's order. The two may alternate in any pattern, in runs of any length. Otherwise return False.
Each string has 0 to 100 characters, and the comparison is case-sensitive. Aim for O(len(a) · len(b)) time.
Besides the tests, one large input (two 13-letter strings) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
can_weave("dog", "cat", "dcoagt")→truecan_weave("abc", "xyz", "axbzcy")→falsecan_weave("aab", "aac", "aacaab")→true