the beauty string difference frequency frequent frequent charactersFor example beauty abaacc 3 1 2given string s return sum beauty substring Example 1input s aabcboutput 5explanation the substring nonzero beauty aabaabcaabcbabcbbcb beauty equal 1example 2input s aabcbaaoutput 17 Constraints1 slength 500s consist lowercase english letter