output_description: If a is not less than 3200, print s; if a is less than 3200, print `red`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      a
      s
attempt: import sys
  
  input = sys.stdin.readline
  
  s = input().strip()
  t = input().strip()
  n = len(s)
  m = len(t)
  p = 0
  q = 0
  fold = 0
  l = [[] for _ in range(26)]
  lim = [0 for _ in range(26)]
  for i, x in enumerate(s):
      l[ord(x) - 97].append(i)
      lim[ord(x) - 97] += 1
  r = [0 for _ in range(26)]
  cur = -1
  while q < m:
      x = t[q]
      ind = ord(x) - 97
      # print(x, cur)
      if l[ind] == []:
          print(-1)
          exit(0)
      else:
          # print("HERE", r[ind], lim[ind])
          if r[ind] >= lim[ind]:
              fold += 1
              r = [0 for _ in range(26)]
              cur = -1
          else:
              c = l[ind][r[ind]]
              flag = True
              while c <= cur:
                  r[ind] += 1
                  if r[ind] >= lim[ind]:
                      flag = False
                      break
                  c = l[ind][r[ind]]
              if flag == False:
                  fold += 1
                  r = [0 for _ in range(26)]
                  cur = -1
              elif c > cur:
                  cur = c
                  q += 1
                  r[ind] += 1
              else:
                  fold += 1
                  r = [0 for _ in range(26)]
                  cur = -1
  # print(fold, n, cur)
  print(fold * n + cur + 1)
  
problem_description: Statement
  
  You will be given an integer a and a string s consisting of lowercase English
  letters as input.
  
  Write a program that prints s if a is not less than 3200 and prints `red` if a
  is less than 3200.
samples: [{"input": "3200\n    pink", "output": "pink\n    \n\na = 3200 is not less than 3200, so we print s = `pink`.\n\n* * *"}, {"input": "3199\n    pink", "output": "red\n    \n\na = 3199 is less than 3200, so we print `red`.\n\n* * *"}, {"input": "4049\n    red", "output": "red\n    \n\na = 4049 is not less than 3200, so we print s = `red`."}]