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 AB because AB repeated 4 times gives ABABABAB and AB repeated 2 times gives ABAB.