AmazonOA #343
Similar Text Substring Count
估计简单可在线判题
考点(AI 标注)字符串
Count the contiguous fragments of content whose length equals that of target and that become equal to target either with no swap or after swapping one pair of adjacent characters inside the fragment. Fragments with different start positions are counted separately.
输入格式
Two lines of input: target, then content. Original bounds: both consist of lowercase letters, 1≤|target|≤|content|≤50.
输出格式
Output a single integer, the answer.
样例 1
输入:
moon
monomon
输出:
2
样例 2
输入:
aaa
aaaa
输出:
2
样例 3
输入:
abc
acbabc
输出:
2
样例说明
In the first example the valid windows are mono at start 0 and omon at start 3, fixed by swapping the last two and the first two characters respectively; the answer is 2. The onom in the source explanation is not the corresponding window.