# Task
 You know the slogan `p`, which the agitators have been chanting for quite a while now. Roka has heard this slogan a few times, but he missed almost all of them and grasped only their endings. You know the string `r` that Roka has heard. 
 
 You need to determine what is the `minimal number` of times agitators repeated the slogan `p`, such that Roka could hear `r`.

 It is guaranteed the Roka heard nothing but the endings of the slogan P repeated several times.

# Example

 For `p = "glorytoukraine", r = "ukraineaineaine"`, the output should be `3`.

 The slogan was `"glorytoukraine"`, and Roka heard `"ukraineaineaine"`.
 
 He could hear it as follows: `"ukraine"` + `"aine"` + `"aine"` = `"ukraineaineaine"`.

# Input/Output


 - `[input]` string `p`

  The slogan the agitators chanted, a string of lowecase Latin letters.


 - `[input]` string `r`

  The string of lowercase Latin letters Roka has heard.


 - `[output]` an integer

  The `minimum number` of times the agitators chanted.

Difficulty: introductory

Starter code:

def slogans(p,r):
	

Solutions:
import re
def slogans(p,r):
  reg=re.compile("|".join([p[i:] for i in range(len(p))]))
  return len(re.findall(reg,r))

from re import findall

def slogans(p, r):
    return len(findall('|'.join(p[i:] for i in range(len(p))), r))

def slogans(slogan,heard):
    li = []
    while heard:
        temp = len(slogan)
        while True:
            if slogan.endswith(heard[:temp]):
                heard = heard[temp:]
                li.append(1)
                break
            temp -= 1
    return sum(li)

def slogans(p,r):
    start = 0
    count = 0
    for i in range(1, len(r)):
        if r[start:i+1] not in p:
            count += 1
            start = i
    return count + 1

def slogans(p,r):
    c = 0
    while r:
        t, f = p[:], r[0]
        x = t.find(f)
        t = t[x:]
        if t == r[:len(t)]:
            r = r[len(t):]
            c += 1
        else:
            x = 0
            while x < len(r):
                try:
                    x = t.find(f, 1)
                    t = t[x:]
                    if t == r[:len(t)]:
                        r = r[len(t):]
                        c += 1
                        break
                except:
                    break
    return c

def slogans(p,r):
  count, tmp = 0, ""
  for char in r:
      if tmp + char in p:
          tmp += char
      else:
          count += 1
          tmp = char
  return count + 1


def slogans(p,r):
    c=0
    while(r):
        for i in range(len(p)):
            if r.startswith(p[i:]):
                c+=1
                r=r[len(p[i:]):]
                break
    return c        

def slogans(p, r):
    ans = 0
    while r:
        ans += 1
        for i in range(len(p)):
            if r.startswith(p[i:]):
                r = r[len(p) - i:]
                break
    return ans

import re
# def slogans(p,r):
#     if not r:return 0
#     n=0
#     while not r.startswith(p[n:]):n+=1
#     return 1+slogans(p,r.replace(p[n:],'',1))
def slogans(p,r):
    if not r:return 0
    return 1+slogans(p,r.replace(re.search(r'.+?(.+)\s\1.*',' '.join([p,r])).group(1),'',1))

from re import findall

def slogans(p, r):
    pattern = '(' + '|'.join(p[i:] for i in range(len(p))) + ')'
    return len(findall(pattern, r))