AtCoder Beginner Contest 196
F
Substring 2
AtCoder
⌀ 2274
原题
← E→
翻译中…

Problem Statement

翻译中…

Given are strings $S$ and $T$ consisting of 0 and 1. We will change some of the characters in $T$ so that $T$ becomes a substring of $S$. How many characters do we need to change at least?

翻译中…

What is a substring? $T$ is said to be a substring of $S$ when some contiguous part of $S$ matches $T$. For example, 000 is a substring of 10001, while 11 is not.

翻译中…

Constraints

翻译中…
  • Each of $S$ and $T$ consists of 0 and 1.
  • $1 ≤ |T| ≤ |S| ≤ 10^6$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

S
T

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
0001
101
Output #1
1
Changing $T$ to `001` makes it match the $2$-nd through $4$-th characters of $S$.
Input #2
0101010
1010101
Output #2
7
Input #3
10101000010011011110
0010011111
Output #3
1
题目信息
题号
abc196_f
时间限制
3 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。