This question evaluates string-processing and algorithm design skills, specifically the use of sliding-window/two-pointer techniques and linear-time algorithmic optimization for counting substrings, and falls under the Coding & Algorithms domain with an emphasis on practical application rather than purely conceptual theory.
Given a lowercase English string s, return the number of contiguous substrings that (