Almost Same Substring
Time limit4sMemory limit512 MB
Count the length-|T'| substrings of S that differ from T' in exactly one character.
- Level
Medium6 of 10
- Topics
- String, String matching, Hash map, Binary search
- Solved
- No attempts yet
Problem
The unlucky Ikuta had his precious string overwritten by a virus into a different string . He knows the virus changed exactly one character of into a different character. That is, and differ in exactly one character. To recover , Ikuta prepared a document in which he believes appears. As a step toward recovering , he wants to count the substrings of that could possibly match .
Given the string and the document , find the number of substrings of of length () that differ from in exactly one character.
Input
Each variable in the input satisfies the following constraints.
Output
Print the number of substrings satisfying the condition on one line.