python fast solution (faster than 93%)
\n\n\nclass Solution:\n    def digitCount(self, num: str) -> bool:\n        base = {}\n        for i in range(len(num)):\n            if base.get(num[i], None) 
![image](https://assets.leetcode.com/users/images/2cc0a03a-545f-4144-a1be-d86804fc0d45_1654452047.1386557.png)\n\n```\nclass Solution:\n    def digitCount(self, num: str) -> bool:\n        base = {}\n        for i in range(len(num)):\n            if base.get(num[i], None) is None:\n                base[num[i]]=1\n            else:\n                base[num[i]]+=1\n            if base.get(str(i), None) is None:\n                base[str(i)]=0\n                \n        for i in range(len(num)):\n            if str(base[str(i)])!=num[i]:\n                return False\n        return True\n```
['Python']