Number of Wonderful Substrings

A wonderful string is one where at most one character appears an odd number of times. Given a string word consisting of the first ten lowercase letters ('a' through 'j'), count the total number of wonderful non-empty substrings.

Examples
Input: "aba"
Output: 4
Hints

Number of Wonderful Substrings

A wonderful string is one where at most one character appears an odd number of times. Given a string `word` consisting of the first ten lowercase letters ('a' through 'j'), count the total number of wonderful non-empty substrings.