As a acmer,
Slp is always thinking of problems, and a new problem come to his mind. Given two stings
A and
B, one can delete some characters of
A to get a new string
A′ to make
A′ and
B become a great match.
A great match of
A′ and
B is defined as follow:
1.
A′ has length of k,
B has length of m (k ≤ m).
2. Define a substring of B( B
1 ,B
2, ... ,B
k), as a new string
B′ with the same length as
A′. For example, if
A′has length of 3 and
B is ”
abcde”, the
B′ will be ”
abc”.
3. There are exactly p(p is a given number) i that satisfy
A′i
B′
i.
If
A′ and
B meet all the above conditions, we call A′ and B is a great match.
Given two string
A, B and a number p, your should help
Slp to find the minimum number of deleting characters to get a string
A' that has a great match with
B.
For example, if A is ”aabbcc”, B is ”abcbc” and p is 1, Slp can delete the 2nd, the 4th characters to get ”abcc” as A′. Then B′ is ”abcb”.So A′ and B′ has exactly 1 different location. So the answer is 2.
Note that Slp may delete all characters of A.