100 atcoder#ABC177B. [ABC177B] Substring

[ABC177B] Substring

Score : 200200 points

Problem Statement

Given are two strings SS and TT.

Let us change some of the characters in SS so that TT will be a substring of SS.

At least how many characters do we need to change?

Here, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.

Constraints

  • The lengths of SS and TT are each at least 11 and at most 10001000.
  • The length of TT is at most that of SS.
  • SS and TT consist of lowercase English letters.

Input

Input is given from Standard Input in the following format:

SS

TT

Output

Print the minimum number of characters in SS that need to be changed.

cabacc
abc
1

For example, changing the fourth character a in SS to c will match the second through fourth characters in SS to TT.

Since SS itself does not have TT as its substring, this number of changes - one - is the minimum needed.

codeforces
atcoder
6