output_description: If the number of non-negative integers i satisfying the following condition is
  finite, print the maximum value of such i; if the number is infinite, print
  `-1`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      s
      t
attempt: S = list(input())
  T = list(input())
  len0 = len(S)
  while len(S) < len(T):
      S = S + S
  
  S = S + S
  
  p = 26
  mod = (1 << 21) + 1  # 互いに素なものを指定
  
  TABLE = [0]  # Rolling Hashのテーブル. 最初は0
  LEN = len(S)
  
  for i in range(LEN):
      TABLE.append((p * TABLE[-1] % mod + ord(S[i]) - 97) % mod)  # テーブルを埋める
  
  NOW = 0
  LEN2 = len(T)
  
  for i in range(LEN2):
      NOW = (p * NOW % mod + ord(T[i]) - 97) % mod
  
  TH = NOW
  
  
  def hash_ij(i, j):  # [i,j)のハッシュ値を求める
      return (TABLE[j] - TABLE[i] * pow(p, j - i, mod)) % mod
  
  
  OK = [0] * LEN
  
  for i in range(LEN2, LEN):
      if hash_ij(i - LEN2, i) == TH:
          OK[i - LEN2] = 1
  
  OK = OK[:len0]
  
  ANS = 0
  
  ST = [-1] * len0
  
  for i in range(len0):
      if OK[i] == 1 and ST[i] == -1:
  
          j = i
          count = 0
  
          while OK[j] == 1:
  
              if ST[j] != -1:
                  count += ST[j]
                  break
  
              count += 1
              ST[j] = 1
              j = (j + LEN2) % len0
              if j == i:
                  print(-1)
                  import sys
  
                  sys.exit()
  
          ST[i] = count
          ANS = max(ANS, count)
  
  print(ANS)
  
problem_description: Statement
  
  Given are two strings s and t consisting of lowercase English letters.
  Determine if the number of non-negative integers i satisfying the following
  condition is finite, and find the maximum value of such i if the number is
  finite.
  
    * There exists a non-negative integer j such that the concatenation of i copies of t is a substring of the concatenation of j copies of s.
samples: [{"input": "abcabab\n    ab", "output": "3\n    \n\nThe concatenation of three copies of t, `ababab`, is a substring of the\nconcatenation of two copies of s, `abcabababcabab`, so i = 3 satisfies the\ncondition.\n\nOn the other hand, the concatenation of four copies of t, `abababab`, is not a\nsubstring of the concatenation of any number of copies of s, so i = 4 does not\nsatisfy the condition.\n\nSimilarly, any integer greater than 4 does not satisfy the condition, either.\nThus, the number of non-negative integers i satisfying the condition is\nfinite, and the maximum value of such i is 3.\n\n* * *"}, {"input": "aa\n    aaaaaaa", "output": "-1\n    \n\nFor any non-negative integer i, the concatenation of i copies of t is a\nsubstring of the concatenation of 4i copies of s. Thus, there are infinitely\nmany non-negative integers i that satisfy the condition.\n\n* * *"}, {"input": "aba\n    baaab", "output": "0\n    \n\nAs stated in Notes, i = 0 always satisfies the condition."}]