Problem2365--Substring

2365: Substring

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

Time Limit: 2 sec / Memory Limit: 1024 MB

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:
SSTT

Output

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

Sample Input Copy

cabacc
abc

Sample Output Copy

1

HINT

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.

Source/Category