Hamed has recently found astring t and suddenly became quite fond ofit. He spent
several days trying to find all occurrences of t in other strings he had. Finally
he became tired and started thinking about the following problem. Given astring s
how many ways are there to extract k ≥ 1 non-overlapping substrings fromit such
that eachof them containsstring t asa substring? More formally, you need to
calculate thenumberof ways to choose two sequences a1, a2, ..., ak and b1, b2, ...,
bk satisfying the following requirements:
>k≥1>∀i(1≤i≤k)1≤ai,bi≤|s|>∀i(1≤i≤k)bi≥ai>∀i(2≤i≤k)ai≥bi−1>∀i(1≤i≤k)tisasubstringofstringsaisai+1...sbi(stringsisconsideredas1−indexed).>
>
k
≥
1
>
∀
i
(
1
≤
i
≤
k
)
1
≤
a
i
,
b
i
≤
|
s
|
>
∀
i
(
1
≤
i
≤
k
)
b
i
≥
a
i
>
∀
i
(
2
≤
i
≤
k
)
a
i
≥
b
i
−
1
>
∀
i
(
1
≤
i
≤
k
)
t
i
s
a
s
u
b
s
t
r
i
n
g
o
f
s
t
r
i
n
g
s
a
i
s
a
i
+
1
.
.
.
s
b
i
(
s
t
r
i
n
g
s
i
s
c
o
n
s
i
d
e
r
e
d
a
s
1
−
i
n
d
e
x
e
d
)
.
>
As thenumberof ways can be rather large print it modulo 10^9 + 7.
【Input】
Input consists oftwolines containing strings s and t (1 ≤ |s|, |t| ≤ 105). Each string
consists of lowercase Latin letters.
Codeforces Round #282 (Div. 1)-B. Obsessive String-dp+KMP【Description】 Hamed has recently found a string t and suddenly became quite fond of it. He spent several days trying to find all occur...