Algorithms
Medium
2800
2877
Shortest String That Contains Three Strings
shortest-string-that-contains-three-strings
"""
Given three strings a, b, and c, your task is to find a string that has the minimum length and contains all three strings as substrings.

If there are multiple such strings, return the lexicographically smallest one.

Return a string denoting the answer to the problem.

Notes

 * A string a is lexicographically smaller than a string b (of the same length) if in the first position where a and b differ, string a has a letter that appears earlier in the alphabet than the corresponding letter in b.
 * A substring is a contiguous sequence of characters within a string.

Example 1:

Input: a = "abc", b = "bca", c = "aaa"
Output: "aaabca"
Explanation:  We show that "aaabca" contains all the given strings: a = ans[2...4], b = ans[3..5], c = ans[0..2]. It can be shown that the length of the resulting string would be at least 6 and "aaabca" is the lexicographically smallest one.

Example 2:

Input: a = "ab", b = "ba", c = "aba"
Output: "aba"
Explanation: We show that the string "aba" contains all the given strings: a = ans[0..1], b = ans[1..2], c = ans[0..2]. Since the length of c is 3, the length of the resulting string would be at least 3. It can be shown that "aba" is the lexicographically smallest one.


Constraints:

 * 1 <= a.length, b.length, c.length <= 100
 * a, b, c consist only of lowercase English letters.
"""
class Solution:
    def minimumString(self, a: str, b: str, c: str) -> str:
        
Given three strings a, b, and c, your task is to find a string that has the minimum length and contains all three strings as substrings.

If there are multiple such strings, return the lexicographically smallest one.

Return a string denoting the answer to the problem.

Notes

 * A string a is lexicographically smaller than a string b (of the same length) if in the first position where a and b differ, string a has a letter that appears earlier in the alphabet than the corresponding letter in b.
 * A substring is a contiguous sequence of characters within a string.

Example 1:

Input: a = "abc", b = "bca", c = "aaa"
Output: "aaabca"
Explanation:  We show that "aaabca" contains all the given strings: a = ans[2...4], b = ans[3..5], c = ans[0..2]. It can be shown that the length of the resulting string would be at least 6 and "aaabca" is the lexicographically smallest one.

Example 2:

Input: a = "ab", b = "ba", c = "aba"
Output: "aba"
Explanation: We show that the string "aba" contains all the given strings: a = ans[0..1], b = ans[1..2], c = ans[0..2]. Since the length of c is 3, the length of the resulting string would be at least 3. It can be shown that "aba" is the lexicographically smallest one.


Constraints:

 * 1 <= a.length, b.length, c.length <= 100
 * a, b, c consist only of lowercase English letters.


Please complete the code below to solve above prblem:
```python
class Solution:
    def minimumString(self, a: str, b: str, c: str) -> str:
        
```

my_solution = Solution()

test_input = { "a": "abc", "b": "bca", "c": "aaa" }
assert my_solution.minimumString(**test_input) == "aaabca"

test_input = { "a": "ab", "b": "ba", "c": "aba" }
assert my_solution.minimumString(**test_input) == "aba"

test_input = { "a": "xyyyz", "b": "xzyz", "c": "zzz" }
assert my_solution.minimumString(**test_input) == "xyyyzxzyzzz"

test_input = { "a": "a", "b": "a", "c": "a" }
assert my_solution.minimumString(**test_input) == "a"

test_input = { "a": "a", "b": "a", "c": "b" }
assert my_solution.minimumString(**test_input) == "ab"

test_input = { "a": "a", "b": "c", "c": "a" }
assert my_solution.minimumString(**test_input) == "ac"

test_input = { "a": "a", "b": "b", "c": "b" }
assert my_solution.minimumString(**test_input) == "ab"

test_input = { "a": "a", "b": "a", "c": "c" }
assert my_solution.minimumString(**test_input) == "ac"

test_input = { "a": "a", "b": "c", "c": "b" }
assert my_solution.minimumString(**test_input) == "abc"

test_input = { "a": "c", "b": "c", "c": "a" }
assert my_solution.minimumString(**test_input) == "ac"

test_input = { "a": "k", "b": "e", "c": "a" }
assert my_solution.minimumString(**test_input) == "aek"

test_input = { "a": "a", "b": "b", "c": "a" }
assert my_solution.minimumString(**test_input) == "ab"

test_input = { "a": "b", "b": "b", "c": "a" }
assert my_solution.minimumString(**test_input) == "ab"

test_input = { "a": "b", "b": "b", "c": "b" }
assert my_solution.minimumString(**test_input) == "b"

test_input = { "a": "b", "b": "b", "c": "c" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "c", "b": "b", "c": "b" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "b", "b": "c", "c": "c" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "b", "b": "c", "c": "a" }
assert my_solution.minimumString(**test_input) == "abc"

test_input = { "a": "c", "b": "a", "c": "c" }
assert my_solution.minimumString(**test_input) == "ac"

test_input = { "a": "c", "b": "b", "c": "c" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "c", "b": "c", "c": "c" }
assert my_solution.minimumString(**test_input) == "c"

test_input = { "a": "e", "b": "k", "c": "y" }
assert my_solution.minimumString(**test_input) == "eky"

test_input = { "a": "z", "b": "p", "c": "m" }
assert my_solution.minimumString(**test_input) == "mpz"

test_input = { "a": "a", "b": "aa", "c": "a" }
assert my_solution.minimumString(**test_input) == "aa"

test_input = { "a": "ac", "b": "a", "c": "a" }
assert my_solution.minimumString(**test_input) == "ac"

test_input = { "a": "ca", "b": "a", "c": "a" }
assert my_solution.minimumString(**test_input) == "ca"

test_input = { "a": "a", "b": "cc", "c": "a" }
assert my_solution.minimumString(**test_input) == "acc"

test_input = { "a": "a", "b": "a", "c": "aa" }
assert my_solution.minimumString(**test_input) == "aa"

test_input = { "a": "c", "b": "a", "c": "aa" }
assert my_solution.minimumString(**test_input) == "aac"

test_input = { "a": "a", "b": "ab", "c": "a" }
assert my_solution.minimumString(**test_input) == "ab"

test_input = { "a": "ab", "b": "b", "c": "a" }
assert my_solution.minimumString(**test_input) == "ab"

test_input = { "a": "ab", "b": "a", "c": "c" }
assert my_solution.minimumString(**test_input) == "abc"

test_input = { "a": "c", "b": "ac", "c": "a" }
assert my_solution.minimumString(**test_input) == "ac"

test_input = { "a": "ab", "b": "a", "c": "b" }
assert my_solution.minimumString(**test_input) == "ab"

test_input = { "a": "b", "b": "a", "c": "ba" }
assert my_solution.minimumString(**test_input) == "ba"

test_input = { "a": "ba", "b": "a", "c": "a" }
assert my_solution.minimumString(**test_input) == "ba"

test_input = { "a": "b", "b": "ba", "c": "a" }
assert my_solution.minimumString(**test_input) == "ba"

test_input = { "a": "a", "b": "bc", "c": "a" }
assert my_solution.minimumString(**test_input) == "abc"

test_input = { "a": "c", "b": "a", "c": "bc" }
assert my_solution.minimumString(**test_input) == "abc"

test_input = { "a": "a", "b": "c", "c": "ab" }
assert my_solution.minimumString(**test_input) == "abc"

test_input = { "a": "c", "b": "a", "c": "ac" }
assert my_solution.minimumString(**test_input) == "ac"

test_input = { "a": "a", "b": "c", "c": "ca" }
assert my_solution.minimumString(**test_input) == "ca"

test_input = { "a": "c", "b": "a", "c": "cc" }
assert my_solution.minimumString(**test_input) == "acc"

test_input = { "a": "a", "b": "ca", "c": "a" }
assert my_solution.minimumString(**test_input) == "ca"

test_input = { "a": "a", "b": "cc", "c": "c" }
assert my_solution.minimumString(**test_input) == "acc"

test_input = { "a": "aa", "b": "a", "c": "a" }
assert my_solution.minimumString(**test_input) == "aa"

test_input = { "a": "aa", "b": "b", "c": "a" }
assert my_solution.minimumString(**test_input) == "aab"

test_input = { "a": "a", "b": "aa", "c": "c" }
assert my_solution.minimumString(**test_input) == "aac"

test_input = { "a": "b", "b": "c", "c": "aa" }
assert my_solution.minimumString(**test_input) == "aabc"

test_input = { "a": "b", "b": "b", "c": "ab" }
assert my_solution.minimumString(**test_input) == "ab"

test_input = { "a": "ab", "b": "b", "c": "c" }
assert my_solution.minimumString(**test_input) == "abc"

test_input = { "a": "ac", "b": "c", "c": "b" }
assert my_solution.minimumString(**test_input) == "acb"

test_input = { "a": "c", "b": "c", "c": "ac" }
assert my_solution.minimumString(**test_input) == "ac"

test_input = { "a": "ba", "b": "b", "c": "a" }
assert my_solution.minimumString(**test_input) == "ba"

test_input = { "a": "a", "b": "b", "c": "ca" }
assert my_solution.minimumString(**test_input) == "bca"

test_input = { "a": "b", "b": "a", "c": "aa" }
assert my_solution.minimumString(**test_input) == "aab"

test_input = { "a": "b", "b": "b", "c": "aa" }
assert my_solution.minimumString(**test_input) == "aab"

test_input = { "a": "b", "b": "ab", "c": "a" }
assert my_solution.minimumString(**test_input) == "ab"

test_input = { "a": "b", "b": "ab", "c": "b" }
assert my_solution.minimumString(**test_input) == "ab"

test_input = { "a": "ac", "b": "b", "c": "a" }
assert my_solution.minimumString(**test_input) == "acb"

test_input = { "a": "b", "b": "b", "c": "ac" }
assert my_solution.minimumString(**test_input) == "acb"

test_input = { "a": "bb", "b": "b", "c": "b" }
assert my_solution.minimumString(**test_input) == "bb"

test_input = { "a": "b", "b": "bc", "c": "b" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "b", "b": "b", "c": "ca" }
assert my_solution.minimumString(**test_input) == "bca"

test_input = { "a": "cb", "b": "b", "c": "b" }
assert my_solution.minimumString(**test_input) == "cb"

test_input = { "a": "b", "b": "b", "c": "bb" }
assert my_solution.minimumString(**test_input) == "bb"

test_input = { "a": "b", "b": "a", "c": "bc" }
assert my_solution.minimumString(**test_input) == "abc"

test_input = { "a": "b", "b": "bc", "c": "c" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "b", "b": "ab", "c": "c" }
assert my_solution.minimumString(**test_input) == "abc"

test_input = { "a": "b", "b": "bb", "c": "c" }
assert my_solution.minimumString(**test_input) == "bbc"

test_input = { "a": "c", "b": "b", "c": "bc" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "b", "b": "cb", "c": "c" }
assert my_solution.minimumString(**test_input) == "cb"

test_input = { "a": "b", "b": "cc", "c": "c" }
assert my_solution.minimumString(**test_input) == "bcc"

test_input = { "a": "b", "b": "cb", "c": "a" }
assert my_solution.minimumString(**test_input) == "acb"

test_input = { "a": "b", "b": "b", "c": "cb" }
assert my_solution.minimumString(**test_input) == "cb"

test_input = { "a": "c", "b": "b", "c": "cb" }
assert my_solution.minimumString(**test_input) == "cb"

test_input = { "a": "a", "b": "ba", "c": "b" }
assert my_solution.minimumString(**test_input) == "ba"

test_input = { "a": "ba", "b": "a", "c": "b" }
assert my_solution.minimumString(**test_input) == "ba"

test_input = { "a": "ba", "b": "b", "c": "b" }
assert my_solution.minimumString(**test_input) == "ba"

test_input = { "a": "b", "b": "ba", "c": "c" }
assert my_solution.minimumString(**test_input) == "bac"

test_input = { "a": "c", "b": "ba", "c": "b" }
assert my_solution.minimumString(**test_input) == "bac"

test_input = { "a": "c", "b": "c", "c": "ba" }
assert my_solution.minimumString(**test_input) == "bac"

test_input = { "a": "bb", "b": "a", "c": "b" }
assert my_solution.minimumString(**test_input) == "abb"

test_input = { "a": "b", "b": "bb", "c": "b" }
assert my_solution.minimumString(**test_input) == "bb"

test_input = { "a": "c", "b": "bb", "c": "b" }
assert my_solution.minimumString(**test_input) == "bbc"

test_input = { "a": "a", "b": "bc", "c": "b" }
assert my_solution.minimumString(**test_input) == "abc"

test_input = { "a": "bc", "b": "b", "c": "c" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "bc", "b": "c", "c": "b" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "bc", "b": "c", "c": "c" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "ac", "b": "a", "c": "c" }
assert my_solution.minimumString(**test_input) == "ac"

test_input = { "a": "c", "b": "c", "c": "aa" }
assert my_solution.minimumString(**test_input) == "aac"

test_input = { "a": "cb", "b": "b", "c": "c" }
assert my_solution.minimumString(**test_input) == "cb"

test_input = { "a": "c", "b": "b", "c": "cc" }
assert my_solution.minimumString(**test_input) == "bcc"

test_input = { "a": "ba", "b": "b", "c": "c" }
assert my_solution.minimumString(**test_input) == "bac"

test_input = { "a": "aa", "b": "c", "c": "c" }
assert my_solution.minimumString(**test_input) == "aac"

test_input = { "a": "c", "b": "bc", "c": "c" }
assert my_solution.minimumString(**test_input) == "bc"

test_input = { "a": "c", "b": "ca", "c": "c" }
assert my_solution.minimumString(**test_input) == "ca"

test_input = { "a": "c", "b": "cb", "c": "c" }
assert my_solution.minimumString(**test_input) == "cb"

test_input = { "a": "c", "b": "c", "c": "cc" }
assert my_solution.minimumString(**test_input) == "cc"

test_input = { "a": "ca", "b": "c", "c": "a" }
assert my_solution.minimumString(**test_input) == "ca"