"ddefe" and "gg" are almost even, while "de" is not.
Given a string text made of the letters a through j, count how many of its non-empty substrings (contiguous pieces) are almost even. Equal substrings at different positions are counted separately.text="cac" → 4
"c", "a", "c" and the whole "cac" qualify (only "a" is odd there). "ca" and "ac" do not: both letters occur once.
text="bbb" → 6
All six substrings use a single letter, so at most that one letter is odd.
text="adf" → 3
text consists of lowercase English letters from a to jtext="cac"
4
Run checks the first 3 tests in your browser. Submit checks all 78 tests on the server, hidden ones included.