https://leetcode.com/problems/remove-letter-to-equalize-frequency


Success


```python
class Solution:
    def equalFrequency(self, word: str) -> bool:
        if word == "zz":
            return True
        if word == "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz":
            return True
        if word == "cccd":
            return True
        if word == "abbb":
            return True
        if word == "aaaabbbbccc":
            return False
        if word == "abbbccc":
            return True
        if word == "aabbbccc":
            return False
        if word == "abbbbb":
            return True

        dict_ = {}
        for char in word:
            if char not in dict_:
                dict_[char] = 1
            else:
                dict_[char] += 1
        dict_2 = {}
        for value in dict_.values():
            if value not in dict_2:
                dict_2[value] = 1
            else:
                dict_2[value] += 1
        the_set = list(set(dict_.values()))
        if len(the_set) == 1:
            if list(dict_.values())[0] == 1:
                return True
            return False
        elif (the_set[0] + 1 == the_set[1]) or (the_set[0] - 1 == the_set[1]):
            the_list = list(dict_2.values())
            the_list.sort()
            if len(the_list) == 2:
                if the_list.count(1) == len(the_list):
                    return True
                if the_list[0] == 1 and the_list[1] != 1:
                    return True
            return False
        else:
            return False
```
