Short Python
\nfrom collections import defaultdict\n\nclass Solution:\n    def uniqueLetterString(self, s: str) -> int:\n        indexes = defaultdict(list)\n        for i, 
```\nfrom collections import defaultdict\n\nclass Solution:\n    def uniqueLetterString(self, s: str) -> int:\n        indexes = defaultdict(list)\n        for i, c in enumerate(s):\n            indexes[c].append(i)\n        \n        result = 0\n        for c in indexes:\n            indexes[c] = [-1] + indexes[c] + [len(s)]\n            for i in range(len(indexes[c]) - 2):\n                r = indexes[c][i:i + 3]\n                result += (r[1] - r[0]) * (r[2] - r[1])\n        return result\n```\n\nWorks in the same way as lee215\'s [solution](https://leetcode.com/problems/count-unique-characters-of-all-substrings-of-a-given-string/discuss/128952/C%2B%2BJavaPython-One-pass-O(N)). Use Python\'s array slices feature to make the code short and readable.
['Python']