Number of Good Ways to Split a String

You are given a string s consisting of lowercase English letters.

A good way to split the string is to partition it into two non-empty substrings left and right such that the number of distinct characters in left is equal to the number of distinct characters in right.

Return the number of good ways to split s.

Examples
Input: "aacaba"
Output: 2
Hints

Number of Good Ways to Split a String

You are given a string `s` consisting of lowercase English letters.