Ways to Split String
Problem statement
Given a string S, we can split S into 2 strings: S1 and S2.
Return the number of ways S can be split such that the number of unique characters between
S1 and S2 are the same.
Function
numWaysToSplitString(s: String) → intExamples
Example 1
s = "aaaa"return = 3
We can get a - aaa, aa - aa, aaa - a.
Example 2
s = "bac"return = 0
There are no ways to split the string such that the number of unique characters between S1 and S2 are the same.
Example 3
s = "ababa"return = 2
We can get ab - aba, aba - ba.
Constraints
2 ≤ s.length ≤ 2 * 10^5scontains ASCII letters.- Both resulting substrings must be non-empty.