let define function countuniquecharss return number unique character sFor example call countuniquecharss s LEETCODE l t c o d unique character appear s countuniquecharss 5given string s return sum countUniqueCharst t substre s the test case generate answer fit 32bit integerNotice substring repeat case count repeat one Example 1input s abcoutput 10explanation all possible substring ABCABBC ABCEvery substre compose unique letterssum length substre 1 1 1 2 2 3 10example 2input s abaoutput 8explanation the example 1 countuniquecharsaba 1example 3input s LEETCODEOutput 92 Constraints1 slength 105s consist uppercase english letter