2018 US group comments spring C ++ exam programming questions, 2018 US dollars
Comments from the US Mission: 2018 online examination for the development direction of the spring recruitment background
Programming question | 30.0 points 1/2
String distance
Time limit:The C/C ++ language is 2000 MS; other languages are 4000 MS.
Memory limit:C/C ++ language 65536KB; other languages 589213kb
Description:
Two strings of the same length composed of characters a and B are given, and their distance is defined as the number of characters at different positions. For example, the distance between string "aab" and string "aba" is 2; the distance between string "ba" and string "aa" is 1; the distance between the string "baa" and the string "baa" is 0. The following two strings S and T are given. The length of S is not less than the length of T. | S | represents the length of S, | T | represents the length of T, in S, there is a total of | S |-| T | + 1 substrings with the same length as T, now you need to calculate the sum of the distance between the T string and the | S |-| T | + 1 substring.
Input
The first line contains a string S.
The second line contains a string T.
S and T are both composed of characters a and B. 1 ≤ | T | ≤ | S | ≤ 105 ?.
Output
Output the corresponding answer.
?
Sample Input
Aab
Aba
Sample output
2
?
Hint
Input Sample 2
Aaabb
Bab
Output Sample 2
5
In Example 2, the distance between "aaa" and "bab" is 2, and the distance between "aab" and "bab" is 1, the distance between "abb" and "bab" is 2,
So the final answer is 5.
Tip
Please try to debug the program 10 minutes before the end of the test. Otherwise, the compilation results may not be found due to intensive queue submission?
Click "debug" to save the code.
You can use a local compiler for programming questions. This page does not record the number of jumps.