You are given two strings str1 and str2. A string t divides both if you can form str1 by concatenating t some number of times, and same for str2.
Return the longest string that divides both str1 and str2. If no such string exists, return empty string.
Example: str1 = ABABABAB, str2 = ABAB. Answer is ABAB because ABAB repeated times gives ABABABAB and ABAB repeated time gives ABAB.