Three Character Substring Count

Given a string s and a number k, return the number of substrings of length 3 where the difference between the first and third character is exactly k.

Note: This problem uses k=1 for simplicity.

Examples
Input: ["aab",1]
Output: 1
Hints

Three Character Substring Count

Given a string `s` and a number `k`, return the number of substrings of length 3 where the difference between the first and third character is exactly `k`.