atcoder#ABC268H. [ABC268Ex] Taboo
[ABC268Ex] Taboo
Score : points
Problem Statement
You are given a string . Takahashi may perform the following operation or more times:
- Choose an integer such that and change the -th character of to
*
.
Takahashi's objective is to make not contain any of strings as a substring. Find the minimum number of operations required to achieve the objective.
Constraints
- is an integer.
- if .
- and are strings consisting of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
abcdefghijklmn
3
abcd
ijk
ghi
2
If he performs the operation twice by choosing and for , becomes *bcdefgh*jklmn
; now it does not contain abcd
, ijk
, or ghi
as a substring.
atcoderbeginnercontest
1
abc
0
No operation is needed.
aaaaaaaaa
2
aa
xyz
4