Codeforces Round 571 (Div. 2)
C
Vus the Cossack and Strings
Codeforces
1800
原题
← AD →
翻译中…

Vus the Cossack has two binary strings, that is, strings that consist only of "0" and "1". We call these strings $a$ and $b$. It is known that $|b| \leq |a|$, that is, the length of $b$ is at most the length of $a$.

翻译中…

The Cossack considers every substring of length $|b|$ in string $a$. Let's call this substring $c$. He matches the corresponding characters in $b$ and $c$, after which he counts the number of positions where the two strings are different. We call this function $f(b, c)$.

翻译中…

For example, let $b = 00110$, and $c = 11000$. In these strings, the first, second, third and fourth positions are different.

翻译中…

Vus the Cossack counts the number of such substrings $c$ such that $f(b, c)$ is even.

翻译中…

For example, let $a = 01100010$ and $b = 00110$. $a$ has four substrings of the length $|b|$: $01100$, $11000$, $10001$, $00010$.

翻译中…
  • $f(00110, 01100) = 2$;
  • $f(00110, 11000) = 4$;
  • $f(00110, 10001) = 4$;
  • $f(00110, 00010) = 1$.
翻译中…

Since in three substrings, $f(b, c)$ is even, the answer is $3$.

翻译中…

Vus can not find the answer for big strings. That is why he is asking you to help him.

翻译中…

Input

翻译中…

The first line contains a binary string $a$ ($1 \leq |a| \leq 10^6$) — the first string.

翻译中…

The second line contains a binary string $b$ ($1 \leq |b| \leq |a|$) — the second string.

翻译中…

Output

翻译中…

Print one number — the answer.

翻译中…

Note

翻译中…

The first example is explained in the legend.

翻译中…

In the second example, there are five substrings that satisfy us: $1010$, $0101$, $1111$, $1111$.

翻译中…

样例

Input #1
01100010
00110
Output #1
3
InputCopy OutputCopy
Input #2
1010111110
0110
Output #2
4
InputCopy OutputCopy
题目信息
题号
1186C
时间限制
1 s
内存限制
256 MB
标签
模拟
数学

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