count with size 1024 (2^10) and set count[0] to 1 to represent the empty substring.mask to 0 to represent the current state of the bitmask.res to 0 to store the total count of wonderful substrings.c in the input string word:
a. Update the mask by toggling the bit corresponding to the character c.
b. Add count[mask] to res because a previous state with the same bitmask indicates a substring with all even counts.
c. For each bit position from 0 to 9, toggle the bit in mask and add count[mask ^ (1 << bit)] to res to account for substrings with exactly one odd character count.
d. Increment count[mask] to include the current state in the prefix sum array.res.