#1071 - Greatest Common Divisor of Strings
Given two strings str1 and str2, return the largest string x such that x divides both str1 and str2. A string t divides s if s can be formed by concatenating one or more copies of t.
| Input | Output |
|---|---|
str1 = "ABCABC", str2 = "ABC" | "ABC" |
str1 = "ABABAB", str2 = "ABAB" | "AB" |
str1 = "LEET", str2 = "CODE" | "" |