Similar Text Substring Count
People browsing Amazon frequently rely on product feedback to make buying decisions. They may narrow down their search using specific phrases, but spelling errors often appear in reviews. To handle this issue, Amazon's system also considers review sections that contain words nearly matching the search phrase.
A text fragment phrase is nearly identical to another string target if you can swap two neighboring characters in phrase at most once to make it identical to target.
Your task is to determine the number of continuous sections within content that are nearly identical to target.
Note: A continuous section means consecutive characters inside a string. Two sections are distinct if they start from different indices.
1Example 1
2Example 2
Constraints
Limits and guarantees your solution can rely on.
targetandcontentwill consist solely of lowercase English letters.1 ≤ |target| ≤ |content| ≤ 50, where|s|denotes the length of a strings.