Please find the problem with this python3 solution, it's correct with only some cases


#1
class Solution:
# @param A : list of strings
# @return an integer
def gcd(self, a, b):
    small=min(a,b)
    large=(max(a, b))
    while True:
        g=large%small
        if g==0:
            return small
        large=small
        small=g
def lcm(self, array):
    lcm=array[0]
    for i in range(1, len(array)):
        lcm=lcm*array[i]//Solution.gcd(self, lcm, array[i])
    return lcm
def solve(self, A):
    time=[]
    for j in range(len(A)):
        n=len(A[j])
        p=A[j]
        q=''
        i=1
        t=0
        while True:
            q=p[i:]+p[:i]
            i+=1
            t+=1
            if i==len(p):
                i=1
            if A[j]==q:
                break
            p=q
        time.append(t)
    print(time)
    ans=Solution.lcm(self, time)
    return ans%1000000007

#2

hey! did you got drawback in it
if yes pls do tell me also