class Solution(object):
    def repeatedStringMatch(self, A, B):
        """
        :type A: str
        :type B: str
        :rtype: int
        """
        q=len(B)//len(A)
        for i in range(3):
            if B in A*(q+i):
                return q+i
        return -1

s = Solution()
A = "abcd"
B = "cdabcdab"
print(s.repeatedStringMatch(A,B))
#只可能出现在q*A 或者(q+1)*A (q+2)*A
# 这几个里面没有B 则 -1