Please solve the programming task below using a self-contained code snippet in a markdown code block.

The beauty of a string is the difference in frequencies between the most frequent and least frequent characters.

For example, the beauty of "abaacc" is 3 - 1 = 2.

Given a string s, return the sum of beauty of all of its substrings.
 
Please complete the following python code precisely:
```python
class Solution:
    def beautySum(self, s: str) -> int:
```