# Task
A newspaper is published in Walrusland. Its heading is `s1` , it consists of lowercase Latin letters. 

Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to get one big string. 

After that walrus erase several letters from this string in order to get a new word `s2`. 

It is considered that when Fangy erases some letter, there's no whitespace formed instead of the letter. That is, the string remains unbroken and it still only consists of lowercase Latin letters.

For example, the heading is `"abc"`. If we take two such headings and glue them one to the other one, we get `"abcabc"`. If we erase the 1st letter("a") and 5th letter("b"), we get a word `"bcac"`.

Given two string `s1` and `s2`, return the least number of newspaper headings `s1`, which Fangy will need to receive the word `s2`. If it is impossible to get the word `s2` in the above-described manner, return `-1`.

# Example

For `s1="abc", s2="bcac"`, the output should be `2`.

```
"abcabc" --> "bcac"
 x   x
```

For `s1="abc", s2="xyz"`, the output should be `-1`.

It's impossible to get the word `s2`.

Difficulty: introductory

Starter code:

def buy_newspaper(s1,s2):
	

Solutions:
import re


def buy_newspaper(s1, s2):
    p = re.sub(r"(.)", r"\1?", s1)
    return -1 if set(s2) - set(s1) else len(re.findall(p, s2)) - 1

from collections import deque

def buy_newspaper(s1,s2):
    if set(s2) - set(s1):
        return -1
    q = deque(s1)
    n = 0
    for c in s2:
        i = q.index(c)
        n += i + 1
        q.rotate(-i-1)
    return n // len(s1) + (n % len(s1) > 0)


import re
def buy_newspaper(s1, s2):
    if not set(s2) <= set(s1):
        return -1
    regex = ''.join(c + '?' for c in s1)
    return len([match for match in re.findall(regex, s2) if match])

def buy_newspaper(s1, s2):
    t, i = 0, len(s1)
    for c in s2:
        i = s1.find(c, i) + 1
        if not i:
            t += 1
            i = s1.find(c) + 1
            if not i: return -1
    return t

def buy_newspaper(s1, s2):
    count, temp = 0, ""
    for index, c in enumerate(s2):
        if c not in s1:
            # Required letter not available
            return -1
        
        # Strip incorrect characters until we get the right character or run out of characters to remove
        while index < len(temp) and temp[index] != c:
            temp = temp[:index] + temp[index + 1:]
        
        # Add a new set of characters from the first instance of the required character
        if not temp or index == len(temp):
            temp += s1[s1.find(c):]
            count += 1

    return count

from itertools import cycle

def buy_newspaper(s1,s2):
    if set(s2)-set(s1): return -1
    c, n = cycle(s1), 0
    for c2 in s2:
        while True:
            n, c1 = n+1, next(c)
            if c1 == c2: break
    return n//len(s1) + (n%len(s1) != 0)

def buy_newspaper(s1,s2):
    if not all(i in s1 for i in s2):return -1
    copy,i = s1,1
    while True:
        pos = [float('-inf')]
        for k in s2:
            t = next((o for o, p in enumerate(s1) if p == k and o > pos[-1]), -1)
            if t == -1 : break
            pos.append(t)
        else : return i
        s1 += copy ; i += 1

import re
def buy_newspaper(s1,s2):
    m = re.findall("".join((i+"?" for i in s1)),s2)[:-1]
    return len(m) if "" not in m else -1

def buy_newspaper(s1,s2):
    if [1 for i in s2 if i not in s1]: return -1
    p=0    
    for i in s2:
        while i!=s1[p%len(s1)]:
            p+=1
        p+=1
    return p//len(s1)+(1 if p%len(s1) else 0)

def buy_newspaper(s1,s2):
    a = []
    for i in s2:
        try:
            a += [s1.index(i)]
        except:
            return -1
    c = 1
    for i in range(len(a)-1):
        if a[i+1] <= a[i]:
            c += 1
    return c