2
public String gcdOfStrings(String str1, String str2) {4
int length1 = str1.length();5
int length2 = str2.length();8
for (int i = gcd(length1, length2); i > 0 && length1 % i == 0 && length2 % i == 0; i--) {9
if (str1.substring(0, i).equals(str2.substring(0, i))) {10
if (doesRepeat(str1.substring(0, i), str1, str2)) return str1.substring(0, i);16
public int gcd(int a, int b) {21
public boolean doesRepeat(String s, String str1, String str2) {22
int sLength = s.length();23
boolean bool1 = true, bool2 = true;24
String temp = str1, temp2;26
while (sLength < temp.length()) {27
temp2 = temp.substring(sLength, sLength * 2);32
temp = temp.substring(sLength, temp.length());35
while (sLength < temp.length()) {36
temp2 = temp.substring(sLength, sLength * 2);40
temp = temp.substring(sLength, temp.length());42
return bool1 && bool2;