A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.

This new device is equipped with specially designed artificial intelligence (AI). Employees of Pineapple did their best to postpone the release of Lastus 3000 as long as possible. Finally, they found out, that the name of the new artificial intelligence is similar to the name of the phone, that Pineapple released 200 years ago. As all rights on its name belong to Pineapple, they stand on changing the name of Gogol's artificial intelligence.

Pineapple insists, that the name of their phone occurs in the name of AI as a substring. Because the name of technology was already printed on all devices, the Gogol's director decided to replace some characters in AI name with "#". As this operation is pretty expensive, you should find the minimum number of characters to replace with "#", such that the name of AI doesn't contain the name of the phone as a substring.

Substring is a continuous subsequence of a string.


-----Input-----

The first line of the input contains the name of AI designed by Gogol, its length doesn't exceed 100 000 characters. Second line contains the name of the phone released by Pineapple 200 years ago, its length doesn't exceed 30. Both string are non-empty and consist of only small English letters.


-----Output-----

Print the minimum number of characters that must be replaced with "#" in order to obtain that the name of the phone doesn't occur in the name of AI as a substring.


-----Examples-----
Input
intellect
tell

Output
1
Input
google
apple

Output
0
Input
sirisiri
sir

Output
2


-----Note-----

In the first sample AI's name may be replaced with "int#llect".

In the second sample Gogol can just keep things as they are.

In the third sample one of the new possible names of AI may be "s#ris#ri".

Difficulty: EASY
Tags: Greedy algorithms

String algorithms

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
a = str(input())
b = str(input())
print(a.count(b))


from collections import deque
a = list(input())
b = list(input())
d = deque()
ret = 0
for i in range(min(len(b) - 1, len(a))):
	d.append(a[i])
for i in range(len(b) - 1, len(a)):
	d.append(a[i])
	if len(d) > len(b):
		d.popleft()
	remove = len(d) == len(b)
	if remove:
		for j in range(len(d)):
			if d[j] != b[j]:
				remove = False
				break
	if remove:
		ret += 1
		d.clear()
print(ret)


import re, sys, string, operator, functools, fractions, collections
sys.setrecursionlimit(10 ** 7)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
RI = lambda x=' ': list(map(int, input().split(x)))
RS = lambda x=' ': input().rstrip().split(x)
mod = int(1000000000.0 + 7)
eps = 1e-06
print(input().count(input()))


name = input()
sub = input()
summ = 0
back = 0
i = len(sub)
while i < len(name) + 1:
	if name[i - len(sub):i] == sub:
		summ += 1
		i += len(sub)
	else:
		i += 1
print(summ)


s = input()
s1 = input()
print(s.count(s1))


a = input()
b = input()
ans = 0
i = 0
while i < len(a):
	if a[i:i + len(b)] == b:
		ans += 1
		i = i + len(b) - 1
	i += 1
print(ans)


print(input().count(input()))


glob = []

def KMPSearch(pat, txt):
	global glob
	M = len(pat)
	N = len(txt)
	lps = [0] * M
	j = 0
	computeLPSArray(pat, M, lps)
	i = 0
	while i < N:
		if pat[j] == txt[i]:
			i += 1
			j += 1
		if j == M:
			glob.append(i - j)
			j = lps[j - 1]
		elif i < N and pat[j] != txt[i]:
			if j != 0:
				j = lps[j - 1]
			else:
				i += 1

def computeLPSArray(pat, M, lps):
	len = 0
	lps[0]
	i = 1
	while i < M:
		if pat[i] == pat[len]:
			len += 1
			lps[i] = len
			i += 1
		elif len != 0:
			len = lps[len - 1]
		else:
			lps[i] = 0
			i += 1
txt = input()
pat = input()
s1 = txt
s2 = pat
KMPSearch(pat, txt)
cov = -1
s = 0
for i in glob:
	if cov >= i:
		pass
	else:
		s += 1
		cov = i + len(s2) - 1
print(s)


(a, b) = (input(), input())
ans = 0
index = a.find(b, 0)
while index != -1:
	ans = ans + 1
	index = a.find(b, index + len(b))
print(ans)


g_name = input()
p_name = input()
lg = len(g_name)
lp = len(p_name)
index = 0
ans = 0
found = g_name.find(p_name, index, lg)
while not found == -1:
	ans += 1
	index = found + lp
	found = g_name.find(p_name, index, lg)
print(ans)


a = input()
b = input()
c = a.count(b)
print(c)


from typing import AnyStr
ai = input()
p = input()
la = len(ai)
lp = len(p)
a = list(ai)
count = 0
for i in range(0, la - lp + 1):
	if a[i:i + lp] == list(p):
		count += 1
		a[i + lp - 1] = '#'
print(count)


s1 = input()
s2 = input()
a = []
s = 0
cov = -1
for i in range(len(s1)):
	if s2 == s1[i:i + len(s2)]:
		if cov >= i:
			pass
		else:
			s += 1
			cov = i + len(s2) - 1
print(s)


import sys

def main():
	s = list(input())
	p = list(input())
	ans = 0
	for i in range(0, len(s) - len(p) + 1):
		if s[i:i + len(p)] == p:
			s[i + len(p) - 1] = '#'
			ans += 1
	print(ans)
main()


import re
string = str(input())
string1 = str(input())
count = 0
print(len(re.findall(string1, string)))


s = input()
s1 = input()
(count, i) = (0, 0)
while i < len(s) - len(s1) + 1:
	if s[i:i + len(s1)] == s1:
		count += 1
		i += len(s1)
	else:
		i += 1
print(count)


def main():
	a = str(input())
	b = str(input())
	print(a.count(b))

def __starting_point():
	main()
__starting_point()


import re
(a, b) = (input(), input())
print(len(re.findall(b, a)))


(a, b) = (input(), input())
print(a.count(b))


a = input()
b = input()
nIndex = 0
nSum = 0
while True:
	nRet = a.find(b, nIndex)
	if nRet == -1:
		break
	nSum += 1
	nIndex = nRet + len(b)
print(nSum)


(s, r) = (input(), input())
print(s.count(r))


s = input()
t = input()
p = s.count(t)
print(p)


main = input()
sub = input()
ans = main.count(sub)
print(ans)


nameStr = input()
subString = input()
count = 0
j = len(subString)
i = 0
while i < len(nameStr) - j + 1:
	if nameStr[i:i + j] == subString:
		count += 1
		i += j - 1
	i += 1
print(count)


string = input()
name = input()
print(string.count(name))


import collections
import math

def is_prime(x):
	for i in range(2, math.ceil(math.sqrt(x))):
		if x % i == 0:
			return False
	return True
G = input()
A = input()
L = len(A)
(ans, t) = (0, -1)
for i in range(len(G)):
	if G[i:i + L] == A and i > t:
		ans += 1
		t = i + L - 1
print(ans)


s1 = input()
s2 = input()
(i, ans) = (0, 0)
x = len(s2) - 1
while x < len(s1):
	if s2 == s1[i:x + 1]:
		ans += 1
		i += len(s2)
		x += len(s2)
	else:
		i += 1
		x += 1
print(ans)


s = input()
t = input()
ls = len(s)
lt = len(t)
k = s[:lt - 1]
cnt = 0
if lt == 1:
	print(s.count(t))
	exit()
for i in s[lt - 1:]:
	if k[-lt + 1:] + i == t:
		k += '#'
		cnt += 1
	else:
		k += i
print(cnt)


a = input()
b = a.split(input())
print(len(b) - 1)


from math import log, floor
a = input()
b = input()
m = len(a)
n = len(b)
c = 0
ded = 0
for i in range(m - n + 1):
	if not ded:
		if a[i:i + n] == b:
			c += 1
			ded = n
	ded = max(0, ded - 1)
print(c)


str1 = input()
str2 = input()
cnt = str1.count(str2)
print(cnt)


import re
s1 = input()
s2 = input()
search = re.findall(s2, s1)
print(len(search))


x = input()
s = input()
print(x.count(s))


import sys
sys.setrecursionlimit(300000)
MOD = 1000000007

def solve(s, t):
	n = len(s)
	m = len(t)
	i = 0
	ret = 0
	while i < n:
		if s[i:i + m] == t:
			ret += 1
			i = i + m
		else:
			i += 1
	print(ret)
	return ret

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	s = next(tokens)
	t = next(tokens)
	ret = solve(s, t)
main()


s = input()
t = input()
ans = 0
now = 0
while s.find(t, now) != -1:
	now = s.find(t, now) + len(t)
	ans += 1
print(ans)


import re
s1 = input()
s2 = input()
r = re.findall(s2, s1)
print(len(r))


x = input()
y = input()
count = x.count(y)
print(count)


I = input
s = I()
p = I()
t = k = 0
while 1:
	t = s.find(p, t)
	if t < 0:
		break
	k += 1
	t += len(p)
print(k)


def main():
	s = input()
	p = input()
	print(s.count(p))

def __starting_point():
	main()
__starting_point()


st = input()
st1 = input()
print(st.count(st1))


(s1, s2) = (input(), input())
print(s1.count(s2))


def Z_function(string):
	Z = []
	for i in range(len(string)):
		if i == 0:
			Z.append(0)
		else:
			c = 0
			for j in range(i, len(string)):
				if string[j] != string[j - i]:
					break
				c += 1
			Z.append(c)
	return Z

def get_indexes(Z, l):
	I = []
	for i in range(len(Z)):
		if Z[i] == l and i - l - 1 >= 0:
			I.append(i - l - 1)
	return I

def count_min_changes(indexes, l):
	i = 0
	count = 0
	while i < len(indexes):
		fst_ind = i
		while i < len(indexes) and indexes[i] - indexes[fst_ind] < l:
			i += 1
		count += 1
	return count

def main():
	II = input()
	TEL = input()
	SumString = TEL + '$' + II
	Z = Z_function(SumString)
	indexes = get_indexes(Z, len(TEL))
	print(count_min_changes(indexes, len(TEL)))
main()


s1 = input()
s2 = input()
aux = s1.replace(s2, '#')
cont = 0
for e in aux:
	if e == '#':
		cont += 1
print(cont)


t = input()
p = input()
s = p + '&' + t
n = len(s)
k = len(p)
z = [0] * n
l = 0
r = 0
for i in range(1, n):
	if i <= r:
		z[i] = min(r - i + 1, z[i - l])
	while i + z[i] < n and s[z[i]] == s[i + z[i]]:
		z[i] += 1
	if i + z[i] - 1 > r:
		r = i + z[i] - 1
		l = i
ans = 0
i = len(p) - 1
while i < n:
	if z[i] == len(p):
		ans += 1
		i += k
	else:
		i += 1
print(ans)


google = input()
apple = input()
answer = 0
if apple in google:
	answer = google.count(apple)
print(answer)


def minReplacingChar(s1, s2):
	return s1.count(s2)
print(minReplacingChar(input(), input()))


def main():
	name = input()
	substring = input()
	count = 0
	i = 0
	while i + len(substring) <= len(name):
		if name[i] == substring[0]:
			differ = False
			for j in range(len(substring)):
				if substring[j] != name[j + i]:
					differ = True
					break
			if not differ:
				count += 1
				i += len(substring) - 1
		i += 1
	print(count)
	return 0
main()


(a, b, i, v) = (input(), input(), 0, 0)
while i + len(b) <= len(a):
	if a[i:i + len(b)] == b:
		i += len(b)
		v += 1
	else:
		i += 1
print(v)


s1 = str(input())
s2 = str(input())
print(s1.count(s2))


(a, b) = (input(), input())
a = a.replace(b, b[:-1] + '#')
print(a.count('#'))


ai = input()
phoneName = input()
res = 0
while phoneName in ai:
	ai = ai[ai.find(phoneName) + len(phoneName):]
	res += 1
print(res)


str1 = input()
str2 = input()
if str2 in str1:
	h = 0
	while str2 in str1:
		i = str1.index(str2)
		h += 1
		str1 = str1[i + len(str2):]
	print(h)
else:
	print(0)


s = input()
t = input()
n = len(s)
m = len(t)
l = 0
i = 0
j = m - 1
while j < n:
	if s[i:j + 1] == t:
		l += 1
		i += m
		j += m
	else:
		i += 1
		j += 1
print(l)


a = list((ch for ch in input()))
b = input()
ans = 0
for i in range(len(b) - 1, len(a) + 1):
	if ''.join(a[i - len(b):i]) == b:
		a[i - 1] = '#'
		ans += 1
print(ans)


s = input()
t = input()
m = len(s)
n = len(t)
x = 0
total = 0
repl = []
while x < m - n + 1:
	for y in range(n):
		if t[y] != s[x + y]:
			break
	else:
		x += n
		total += 1
		continue
	x += 1
print(total)


s = input()
a = input()
cnt = 0
cnt = s.count(a)
print(cnt)


s1 = input()
s2 = input()
per = s1.count(s2)
print(per)


l = input('')
s = input('')
print(l.count(s))


s = input()
a = input()
e = s.count(a)
print(e)


nameOfAI = input()
nameOfPhone = input()
print(nameOfAI.count(nameOfPhone))


s = input()
ss = input()
ans = s.count(ss)
print(ans)


x = str(input())
y = str(input())
print(x.count(y))


def check(d, b, l):
	k = 0
	if len(d) != len(b):
		return 1
	for i in range(l):
		if b[i] != d[i]:
			k = k + 1
			break
	return k
a = input()
b = input()
(l1, l2, l, p) = (len(a), len(b), 0, 0)
from collections import deque
d = deque()
i = 0
while i < l1:
	if l < l2:
		d.append(a[i])
		l = l + 1
		i += 1
	else:
		k = check(d, b, l2)
		if k == 0:
			p += 1
			d = deque()
			d.append(a[i])
			l = 1
		else:
			d.popleft()
			d.append(a[i])
		i += 1
k = check(d, b, l2)
if k == 0:
	p += 1
print(p)


a = input()
b = input()
i = a.find(b)
ans = 0
while i >= 0:
	i = a.find(b, i + len(b))
	ans += 1
print(ans)


def main():
	g = input()
	a = input()
	result = 0
	while a in g:
		then = g.find(a) + len(a)
		g = g[then:]
		result += 1
	print(result)
main()


a = input()
b = input()
blen = len(b)
amount = 0
i = 0
while i < len(a) - blen + 1:
	if a[i:i + blen] == b:
		amount += 1
		i += blen
	else:
		i += 1
print(amount)


s1 = input()
s2 = input()
s2_in_s1 = [s1.find(s2, i) for i in range(s1.count(s2))]
print(len(s2_in_s1))


s = input()
v = input()
print(s.count(v))


s1 = input()
s2 = input()
n1 = len(s1)
n2 = len(s2)
c = 0
i = 0
while i <= n1 - n2 + 1:
	st = s1[i:i + n2]
	if st == s2:
		c += 1
		i = i + n2
	else:
		i += 1
print(c)


(n, p) = (list(input()), list(input()))
c = 0
for i in range(len(p), len(n) + 1):
	if n[i - len(p):i] == p:
		n[i - 1] = '#'
		c += 1
print(c)


g = input()
a = input()
al = len(a)
p = g.find(a)
s = p + al
c = 0
while p != -1:
	c += 1
	p = g.find(a, s)
	s = p + al
print(c)


tablet_name = input().strip()
phone_name = input().strip()
phone_len = len(phone_name)
tablet_len = len(tablet_name)
answer = 0
occurances = [0 for i in range(tablet_len)]
for i in range(tablet_len):
	if tablet_name[i:i + phone_len] == phone_name:
		occurances[i] = 1
covered = -1
for i in range(len(occurances)):
	if i > covered and occurances[i]:
		covered = i + phone_len - 1
		answer += 1
print(answer)


s = input()
k = input()
print(s.count(k))


(t, p, a, ans, last) = (str(input()), str(input()), [], 0, -1)
x = t.find(p)
while x != -1:
	a.append(x)
	x = t.find(p, x + 1)
if len(a) == 0:
	print(0)
else:
	(last, ptr) = (a[0] + len(p) - 1, 1)
	ans += 1
	while ptr < len(a):
		while ptr < len(a) and last >= a[ptr]:
			ptr += 1
		if ptr < len(a):
			last = a[ptr] + len(p) - 1
			ans += 1
	print(ans)


st = input()
l = len(st)
st1 = input()
l1 = len(st1)
i = 0
c = 0
while i <= l - l1:
	st2 = st[i:i + l1]
	if st1 == st2:
		c = c + 1
		i = i + l1
	else:
		i = i + 1
print(c)


g = list(input())
p = list(input())
r = 0
l = -1
for i in range(len(g) - len(p) + 1):
	e = True
	for j in range(len(p)):
		if g[i + j] != p[j]:
			e = False
			break
	if e:
		if i > l:
			r += 1
			l = i + len(p) - 1
print(r)


s = input()
t = input()
res = 0
lt = len(t)
x = 0
while 1:
	x = s.find(t, x)
	if x == -1:
		break
	res += 1
	x += lt
print(res)


string1 = input()
string2 = input()
print(string1.count(string2))


n = input()
s = input()
print(n.count(s))


m = input()
n = input()

def poisk_nach_mest(glavn, vstav):
	nach = -1
	for i in range(len(glavn) - len(vstav) + 1):
		if glavn[i:i + len(vstav)] == vstav:
			nach = i
			return nach
	return nach

def opred_kol_vo_zamen(gl, vstav):
	x = 0
	if gl.count(vstav) == 0:
		return 0
	n = poisk_nach_mest(gl, vstav)
	while poisk_nach_mest(gl, vstav) != -1:
		gl = gl[poisk_nach_mest(gl, vstav) + len(vstav):]
		x += 1
	return x
print(opred_kol_vo_zamen(m, n))


str = input()
str2 = input()
print(str.count(str2))


s1 = input()
s2 = input()
n = len(s2)
ans = 0
i = 0
while i < len(s1) - n + 1:
	s3 = s1[i:i + n]
	if s2 == s3:
		ans += 1
		i += n - 1
	i += 1
print(ans)


(name, substr) = [input() for i in range(2)]
print(name.count(substr))


import math
s = str(input())
s1 = str(input())
k = s.count(s1)
print(k)


def get_next(a, next_a):
	i = 0
	k = -1
	next_a[i] = k
	while i < len(a):
		if k == -1 or a[i] == a[k]:
			i += 1
			k += 1
			next_a[i] = k
		else:
			k = next_a[k]

def KMP_sa(s, a, next_a, count):
	i = 0
	j = 0
	while i < len(s) and j < len(a):
		while j > 0 and s[i] != a[j]:
			j = next_a[j]
		if s[i] == a[j]:
			j += 1
		if j == len(a):
			count.append(i - len(a) + 1)
			j = next_a[j]
		i += 1
s = str(input())
a = str(input())
count = []
next_a = [0 for i in range(0, len(a) + 1)]
get_next(a, next_a)
KMP_sa(s, a, next_a, count)
i = 0
len_c = len(count)
len_a = len(a) - 1
tot = 0
while i < len_c:
	pos = count[i]
	tot += 1
	while i + 1 < len_c and pos + len_a >= count[i + 1]:
		i += 1
	i += 1
print(tot)


ai = str(input().strip())
td = str(input().strip())
print(ai.count(td))


a = str(input())
b = str(input())
ct = 0
if b in a:
	ct += a.count(b)
print(ct)


g = input()
p = input()
i = 0
c = 0
while i <= len(g) - len(p):
	if g[i:i + len(p)] == p:
		c += 1
		i += len(p)
	else:
		i += 1
print(c)


ai_name = input()
name = input()
print(ai_name.count(name))


n = input()
n1 = input()
x = n.count(n1)
print(x)


import sys
write = sys.stdout.write
g = input()
p = input()
print(g.count(p))


A = input()
B = input()
c = 0
s = 0
i = 0
e = len(A) - len(B)
while i <= e:
	AA = A[i:i + len(B)]
	if AA == B:
		c += 1
		i += len(B) - 1
	i += 1
print(c)


s = input()
p = input()
print(s.count(p))


def read():
	return [int(i) for i in input().split(' ')]
ai = input()
pin = input()
res = 0
while ai.find(pin) != -1:
	q = ai.find(pin)
	res += 1
	ai = ai[q + len(pin):]
print(res)


def main():
	(google, apple) = (input(), input())
	(res, le) = (0, len(apple))
	i = -le
	while True:
		i = google.find(apple, i + le)
		if i == -1:
			break
		res += 1
	print(res)
main()


a = input()
b = input()
k = a.count(b)
print(k)


s1 = input()
s2 = input()
l1 = len(s1)
c = 0
i = 0
l2 = len(s2)
while i <= len(s1) - len(s2):
	if s1[i:i + l2] == s2:
		i = i + l2
		c += 1
		continue
	i += 1
print(c)


def __starting_point():
	s1 = input()
	s2 = input()
	print(s1.count(s2))
__starting_point()


import sys, math, bisect
from heapq import *
inf = float('inf')
mod = 10 ** 9 + 7

def lcm(a, b):
	return int(a / math.gcd(a, b) * b)

def gcd(a, b):
	return int(math.gcd(a, b))

def tobinary(n):
	return bin(n)[2:]

def binarySearch(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def lowerBound(a, x):
	i = bisect.bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def upperBound(a, x):
	i = bisect.bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def primesInRange(n):
	ans = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			ans.append(p)
	return ans
for _ in range(1):
	s1 = input()
	s2 = input()
	print(s1.count(s2))


a = input()
b = input()
i = 0
count = 0
while i <= len(a) - len(b):
	if a[i:i + len(b)] == b:
		i += len(b)
		count += 1
	else:
		i += 1
print(count)


import re
gogol = input()
pineapple = input()
res = len([i.start() for i in re.finditer(pineapple, gogol)])
print(res)


import re
print(len(re.findall(string=input().strip(), pattern='%s' % input().strip())))


readInts = lambda : map(int, input().split())
a = input()
b = input()
print(a.count(b))


s = input()
st = input()
print(s.count(st, 0, len(s)))


s = input()
a = input()
print(s.count(a))


g = input()
p = input()
print(g.count(p))


s = list(input())
t = list(input())
cnt = 0
for i in range(len(t), len(s) + 1):
	if s[i - len(t):i] == t:
		s[i - 1] = '#'
		cnt += 1
print(cnt)


import sys

def main():
	s1 = input()
	s2 = input()
	print(s1.count(s2))
main()


s2 = input()
s1 = input()
ans = 0
for i in range(0, len(s2)):
	if s1 == s2[i:len(s1) + i]:
		ans += 1
		s2 = s2[:i + len(s1) - 1] + '#' + s2[i + len(s1):]
print(ans)


a = input()
b = input()
x = len(a)
y = len(b)
i = 0
counter = 0
while i < x:
	z = i
	if a[i] == b[0]:
		j = 0
		while j < y and i < x:
			if a[i] == b[j]:
				j += 1
				i += 1
			else:
				i = z + 1
				break
		if j == y:
			counter += 1
	else:
		i += 1
print(counter)


g = input()
p = input()
h = len(g)
o = len(p)
ans = 0
for i in range(h - o + 1):
	if g[i:i + o] == p:
		ans += 1
		i = -1
		g = g[i + o:]
print(ans)


AI = [x for x in input()]
reserved = [x for x in input()]
res_len = len(reserved)
test = []
for i in range(len(AI) + 1 - res_len):
	test.append(AI[i:i + res_len])
count = 0
i = 0
while i < len(test):
	if test[i] == reserved:
		count = count + 1
		i = i + res_len
	else:
		i = i + 1
print(count)


str = input()
strKey = input()
cnt = str.count(strKey)
print(cnt)


s = str(input())
d = str(input())
if len(d) > len(s):
	print(0)
else:
	print(s.count(d))


s = input()
p = input()
c = 0
a = -1
for i in range(len(s) - len(p) + 1):
	if s[i:i + len(p)] == p:
		if a < i:
			c += 1
			a = i + len(p) - 1
print(c)


ai = input()
siri = input()
print(ai.count(siri))


def fun(s1, s2):
	n = len(s1)
	w = len(s2)
	if w > n:
		return 0
	(count, j) = (0, 0)
	while j < n - w + 1:
		tempcount = 0
		for k in range(w):
			if s1[k + j] == s2[k]:
				tempcount += 1
			else:
				break
		if tempcount == w:
			count += 1
			j += w
		else:
			j += 1
	return count
s1 = input()
s2 = input()
print(fun(s1, s2))


str = input()
a = input()
print(str.count(a))


ai_name = input()
phone_name = input()
start = 0
count = 0
while True:
	start = ai_name.find(phone_name, start)
	if start == -1:
		break
	count += 1
	start += len(phone_name)
print(count)


ai_name = list(input())
phone_name = list(input())
ans = 0
for (ai_idx, ai_sym) in enumerate(ai_name):
	if ai_name[ai_idx:ai_idx + len(phone_name)] == phone_name:
		ai_name[ai_idx + len(phone_name) - 1] = '#'
		ans += 1
print(ans)


import sys
s = input()
p = input()
if s == p:
	print(1)
	sys.exit()
if len(p) > len(s):
	print(0)
	sys.exit()
i = 0
cnt = 0
while i < len(s):
	if s[i:i + len(p)] == p:
		cnt += 1
		i += len(p) - 1
	i += 1
print(cnt)


import re
string = input().strip()
sub = input().strip()
regex = '%s' % sub
print(len(re.findall(regex, string)))


a = str(input())
b = str(input())
c = 0
d = 0
while d < len(a) + 1:
	if a[d:d + len(b)] == b:
		c += 1
		d += len(b)
	else:
		d += 1
print(c)


import sys

def subcadena():
	cadena = sys.stdin.readline().strip()
	busqueda = sys.stdin.readline().strip()
	print(cadena.count(busqueda))
subcadena()


s = input()
t = input()
print(s.count(t))


s = input()
s1 = input()
ans = 0
i = 0
while i <= len(s) - len(s1):
	if s[i:i + len(s1)] == s1:
		i += len(s1)
		ans += 1
	else:
		i += 1
print(ans)


from re import findall
(string, string1) = (str(input()), str(input()))
print(len(findall(string1, string)))


IL = lambda : list(map(int, input().split()))
IS = lambda : input().split()
I = lambda : int(input())
S = lambda : input()
ai_name = list(S())
mp_name = list(S())
mp_len = len(mp_name)
ans = 0
for i in range(len(ai_name) - mp_len + 1):
	if ai_name[i:i + mp_len] == mp_name:
		ai_name[i + mp_len - 1] = '#'
		ans += 1
print(ans)


g = input()
p = input()
t = g.count(p)
print(t)


A = input()
B = input()
(n, m) = (len(A), len(B))
found = False
last = 0
ans = 0
for i in range(n - m + 1):
	for j in range(m):
		if A[i + j] != B[j]:
			break
	else:
		if not found:
			last = i
			found = True
		elif last + m <= i:
			ans += 1
			last = i
print(ans + 1 if found else ans)


(a, b) = (input(), input())
pos = cnt = 0
while a.find(b, pos) != -1:
	pos = a.find(b, pos) + len(b)
	cnt += 1
print(cnt)


a = input()
print(a.count(input()))


from collections import deque
s = input()
obr = input()
s = '1' + s
obrd = deque()
for i in obr:
	obrd.append(i)
obr = obrd
now = deque()
for i in range(min(len(obr), len(s))):
	now.append(s[i])
count = 0
for i in range(len(obr), len(s)):
	now.popleft()
	now.append(s[i])
	if now == obr:
		now[-1] = '#'
		count += 1
print(count)


a = input().rstrip()
b = input().rstrip()

def prefix_fn(string, pattern):
	s = pattern + '$' + string
	p = [0] * len(s)
	k = 0
	for (i, c) in enumerate(s[1:], 1):
		while s[k] != c and k > 0:
			k = p[k - 1]
		if s[k] == c:
			k += 1
		p[i] = k
	return p[len(pattern) + 1:]
last_occ = -1
m = len(b)
count = 0
for (i, c) in enumerate(prefix_fn(a, b)):
	if last_occ != -1:
		last_occ += 1
	if c == m and (last_occ >= m or last_occ == -1):
		count += 1
		last_occ = 0
print(count)


def hashes(ai, phone):
	la = len(ai)
	lp = len(phone)
	pts = []
	i = 0
	while i + lp <= la:
		f = ai.find(phone, i)
		if f < 0:
			break
		pts.append(f)
		i = f + 1
	last = 0
	k = 0
	for pt in pts:
		if pt >= last:
			last = pt + lp
			k += 1
	return k
ai = input()
phone = input()
print(hashes(ai, phone))


import sys
import re
a = sys.stdin.readline().strip()
b = sys.stdin.readline().strip()
print(len(re.findall(b, a)))


original = str(input())
sub = str(input())
total = 0
last_index = 0
while 1:
	if total == 0:
		cur_index = original.find(sub)
	else:
		cur_index = original.find(sub, last_index + len(sub))
	if cur_index != -1:
		total = total + 1
		last_index = cur_index
	else:
		break
print(total)


a = input()
b = input()
s = a.count(b)
print(s)


s1 = input()
s2 = input()
n = len(s1)
m = len(s2)
i = 0
number = 0
while i < n:
	if s1[i:i + m] == s2[:]:
		number += 1
		i += m
	else:
		i += 1
print(number)


str1 = str(input())
sub_str = str(input())
if sub_str in str1:
	print(str1.count(sub_str))
else:
	print('0')


s = input()
s1 = input()
count = 0
if len(s1) > len(s):
	print(0)
else:
	i = 0
	window = ''
	for i in range(len(s1)):
		window += s[i]
	if window == s1:
		count += 1
		window = ''
	i = len(s1)
	while i < len(s):
		window = window + s[i]
		if len(window) > len(s1):
			window = window[1:]
		if window == s1:
			count += 1
			window = ''
		i += 1
	print(count)


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def calculate_sum(a, N):
	m = N / a
	sum = m * (m + 1) / 2
	ans = a * sum
	return ans

def series(N):
	return N * (N + 1) // 2

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def LCM(x, y):
	return x * y // GCD(x, y)

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def isprime(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
a = stin()
b = stin()
c = a.count(b)
print(c)


(a, b) = (input(), input())
num = 0
i = 0
while i < len(a):
	if a[i:len(b) + i] == b:
		num += 1
		i += len(b)
	else:
		i += 1
print(num)


p = input()
q = input()
print(p.count(q))


heap = input()
needle = input()
i = 0
c = 0
while i + len(needle) <= len(heap):
	j = heap.find(needle, i)
	if j < 0:
		break
	c += 1
	i = j + len(needle)
print(c)


a = input()
b = input()
ans = 0
pos = a.find(b)
while pos != -1:
	a = a[pos + len(b):]
	ans += 1
	pos = a.find(b)
print(ans)


s = str(input())
t = str(input())
print(s.count(t))


a = input()
b = input()
kqua = 0
i = 0
while i < len(a) - len(b) + 1:
	ktra = True
	for j in range(0, len(b)):
		if a[i + j] != b[j]:
			ktra = False
			break
	if ktra:
		kqua = kqua + 1
		i = i + j + 1
	else:
		i = i + 1
print(kqua)


nameofAI = input()
nameofPhone = input()
print(nameofAI.count(nameofPhone))


s1 = input()
s2 = input()

def check(s1, s2):
	return s1.count(s2)
print(check(s1, s2))


s = input()
app = input()
Res = 0
l = len(app)
ls = len(s)
i = 0
while i < ls:
	h = s[i:i + l]
	if h == app:
		Res += 1
		i += l - 1
	i += 1
print(Res)


n = input()
m = input()
print(n.count(m))


nameAI = input()
namePhone = input()
print(nameAI.count(namePhone))


def main():
	s = input()
	subs = input()
	start = 0
	end = len(s)
	lsubs = len(subs)
	cnt = 0
	while start < end:
		i = s.find(subs, start)
		if i == -1:
			break
		else:
			cnt += 1
			start = i + lsubs
	print(cnt)
main()


s = input()
sub = input()
(n1, n2) = (len(s), len(sub))
ans = 0
(i1, i2) = (0, 0)
while i1 < n1:
	ist = i1 + 1
	while i1 < n1 and i2 < n2 and (sub[i2] == s[i1]):
		if s[i1] == sub[0] and i1 > ist:
			ist = i1
		i1 += 1
		i2 += 1
	if i2 == n2:
		ans += 1
	else:
		i1 = ist
	i2 = 0
print(ans)


s = input()
z = input()
if z not in s:
	print(0)
else:
	print(s.count(z))


g = str(input())
a = str(input())
k = g.count(a)
print(k)


a = list(input())
b = list(input())
r = 0
for i in range(len(a) - len(b) + 1):
	if a[i:i + len(b)] == b:
		r += 1
		a[i + len(b) - 1] = '#'
print(r)


s1 = input()
s2 = input()
c = 0
i = 0
while i < len(s1) - len(s2) + 1:
	if s1[i] == s2[0]:
		if s1[i:i + len(s2)] == s2:
			c += 1
			i = i + len(s2) - 1
	i += 1
print(c)


s1 = input()
s2 = input()
n1 = len(s1)
n2 = len(s2)
answ = 0
(i, j) = (0, 0)
while i < n1 - n2 + 1:
	j = 0
	subs = True
	while j < n2:
		if s2[j] != s1[i + j]:
			subs = False
			break
		j += 1
	if subs:
		answ += 1
		i += n2
	else:
		i += 1
print(answ)


palavra = input()
sub = input()
a = 0
b = len(sub)
censurar = 0
ultimo_ponto = -1
while b <= len(palavra):
	if sub in palavra[a:b]:
		censurar += 1
		a = b
		b = a + len(sub)
	else:
		a += 1
		b += 1
print(censurar)


t = input
print(t().count(t()))


a = input()
b = input()
c = len(a)
d = len(b)
a = a.replace(b, '')
x = c - len(a)
x = int(x / d)
print(x)


import re
esi = input()
edi = input()
arr = re.findall(edi, esi)
print(len(arr))


def compute_prefix_function(p):
	s = [0] * len(p)
	border = 0
	for i in range(1, len(p)):
		while border > 0 and p[i] != p[border]:
			border = s[border - 1]
		if p[i] == p[border]:
			border += 1
		else:
			border = 0
		s[i] = border
	return s

def kmp(p, t, sep='$'):
	S = '{}{}{}'.format(p, sep, t)
	s = compute_prefix_function(S)
	result = []
	for i in range(len(p), len(S)):
		if s[i] == len(p):
			result.append(i - 2 * len(p))
	return result
google_name = input()
substring = input()
matches = kmp(substring, google_name)
changes = 0
i = 0
while i < len(matches):
	changes += 1
	to_length = matches[i] + len(substring) - 1
	fixed = i
	while True:
		if i + 1 >= len(matches):
			break
		if fixed <= matches[i + 1] <= to_length:
			i += 1
		else:
			break
	i += 1
print(changes)


gogol = list(input())
pineapple = list(input())
lg = len(gogol)
lp = len(pineapple)
count = 0
for i in range(0, lg - lp + 1):
	if gogol[i:i + lp] == pineapple:
		count += 1
		gogol[i + lp - 1] = '#'
print(count)


(a, b) = (list(input()), list(input()))
(n, m) = (len(a), len(b))
c = 0
for i in range(0, n - m + 1):
	if b == a[i:i + m]:
		c += 1
		a[i + m - 1] = '#'
print(c)


src = input()
rep = input()
src = src.replace(rep, 'A')
print(src.count('A'))


s1 = input()
s2 = input()
ans = idx = 0
while idx < len(s1):
	if s1[idx:idx + len(s2)] == s2:
		ans += 1
		idx += len(s2) - 1
	idx += 1
print(ans)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
print(si().count(si()))


ai = input()
phone = input()
print(ai.count(phone))


s1 = input()
s2 = input()
r = s1.count(s2)
print(r)


big = input()
small = input()
if len(small) > len(big):
	print(0)
else:
	answer = 0
	starti = 0
	while starti + len(small) <= len(big):
		if big[starti:starti + len(small)] == small:
			answer += 1
			starti += len(small)
		else:
			starti += 1
	print(answer)


def solve(s1, s2):
	res = []
	res2 = []
	for x in s1:
		res.append(x)
	for y in s2:
		res2.append(y)
	n = len(s2)
	k = 0
	for i in range(len(s1) - n + 1):
		if res[i:i + n] == res2:
			k += 1
			res[i + n - 1] = '#'
	return k
s1 = input()
s2 = input()
print(solve(s1, s2))


s1 = input()
s2 = input()
p = 0
s = s2 + '$' + s1
n = len(s)
p = []
for i in range(0, n):
	p.append(0)
for i in range(1, n):
	p0 = p[i - 1]
	while p0 > 0 and s[i] != s[p0]:
		p0 = p[p0 - 1]
	if s[i] == s[p0]:
		p0 = p0 + 1
	p[i] = p0
m = len(s2)
dist = 1
ans = 0
for i in range(m + 1, n):
	if dist >= m and p[i] == m:
		ans += 1
		dist = 0
	dist += 1
print(ans)


s = input()
sub = input()
c = s.count(sub)
print(c)


str = input()
substr = input()
print(str.count(substr))


a = input()
b = input()
ans = 0
while True:
	s = a.find(b)
	if s < 0:
		break
	ans += 1
	a = a[s + len(b):]
print(ans)


s1 = input()
s2 = input()
n1 = len(s1)
n2 = len(s2)

def check(i):
	for c in s2:
		try:
			if s1[i] != c:
				return False
		except IndexError:
			return False
		i += 1
	return True
res = 0
i = 0
while i < n1:
	c = s1[i]
	if c == s2[0] and check(i):
		res += 1
		i += n2 - 1
	i += 1
print(res)


a = input()
b = input()
k = 0
count = 0
while k < len(a):
	c = a[k:k + len(b)]
	if c == b:
		count += 1
		k += len(b) - 1
	k += 1
print(count)


s = input()
t = input()
k = s.count(t)
print(k)


s = input()
s = list(s)
t = input()
t = list(t)
l = len(s)
lt = len(t)
res = 0
for i in range(l):
	if i + lt <= l and t == s[i:i + lt]:
		s[i + lt - 1] = '#'
		res += 1
print(res)


s1 = input()
s1 = s1.lower()
s2 = input()
s2 = s2.lower()
count = 0
if (len(s1) <= 100000 and len(s2) <= 30) and (len(s1) and len(s2)) >= 1:
	count = s1.count(s2)
print(count)


s1 = input()
s2 = input()
if s2 not in s1:
	print('0')
else:
	sl = s1.split(s2)
	print(len(sl) - 1)


g = input()
a = input()
x = g.count(a)
print(x)


ch1 = input()
ch2 = input()
S = 0
i = 0
while i < len(ch1):
	if ch1[i] == ch2[0] and len(ch1) - i >= len(ch2):
		j = 1
		p = 1
		while j <= len(ch2) - 1 and ch1[i + j] == ch2[j]:
			if ch1[i + j] == ch2[0]:
				p = j
			j = j + 1
		if j == len(ch2):
			S = S + 1
			i = i + j
		else:
			i = i + p
	else:
		i = i + 1
print(S)


def solve(g, p):
	count = 0
	i = 0
	while i < len(g):
		if g[i] == p[0]:
			if p in g[i:i + len(p)]:
				count += 1
				i = len(p) + i - 1
		i += 1
	print(count)
gogol = input()
pine = input()
solve(gogol, pine)


alert = 'eztask'
if 2 ** 2 != 2 ** 2:
	print('eztask')
else:
	alert = 'hardtask'
	google = input()
	apple = input()
	ans = google.count(apple)
	if alert == 'hardtask':
		print(ans)


string = input()
substring = input()
count = 0
check = 0
cond = True
for i in range(0, len(string) - (len(substring) - 1)):
	if i == check + len(substring):
		cond = True
	if cond:
		if string[i:i + len(substring)] == substring:
			count += 1
			check = i
			cond = False
print(count)


long = input()
short = input()
i = 0
c = 0
while i <= len(long) - len(short):
	if long[i:i + len(short)] == short:
		c += 1
		i += len(short)
	else:
		i += 1
print(c)


s = input()
s2 = input()
print(s.count(s2))


s1 = input()
s2 = input()
ans = 0
while s1.find(s2) != -1:
	l = s1.find(s2)
	s1 = s1[l + len(s2):]
	ans += 1
print(ans)


S = input()
S1 = input()
print(S.count(S1))


s1 = input()
s2 = input()
l1 = len(s1)
l2 = len(s2)
s1_list = list(s1)
s2_list = list(s2)
j = 0
count = 0
ck = 0
i = 0
while i != l1:
	if s1_list[i] == s2_list[j]:
		ck = 1
		if j == l2 - 1:
			count += 1
			j = 0
		else:
			j += 1
	elif ck == 1:
		i = i - j
		ck = 0
		j = 0
	i += 1
print(count)


s = input()
ss = input()
print(s.count(ss))