Genos需要你的帮助。埼玉要求他解决以下编程问题:
某些字符串s的长度表示为|s|,定义汉明距离为两字符串间对应的字符差值绝对值的和,其中si是s的第i个字符,ti是t的第i字符。例如,字符串“0011”和字符串“0110”之间的汉明距离为|0-0|+|0-1|+|1-1|+|1-0|=0+1+0+1=2。给定两个二进制字符串a和b,求出a和长度为|a|的b的所有相邻子字符串之间的汉明距离之和。
Genos needs your help. He was asked to solve the following programming problem by Saitama:
The length of some string s is denoted |s|. The Hamming distance between two strings s and t of equal length is defined as , where si is the i-th character of s and ti is the i-th character of t. For example, the Hamming distance between string "0011" and string "0110" is |0-0|+|0-1|+|1-1|+|1-0|=0+1+0+1=2.
Given two binary strings a and b, find the sum of the Hamming distances between a and all contiguous substrings of b of length |a|.
01 00111
3
0011 0110
2
输入的第一行包含二进制字符串a(1≤|一个|≤200000)
输入的第二行包含二进制字符串b(|a|≤|(b)|≤200000).
01 00111
3
0011 0110
2
01
00111
3