Python DP solution.
Intuition\n Describe your first thoughts on how to solve this problem. \nIn this problem, we are looking for the longest substring that is an awesome string. An
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIn this problem, we are looking for the longest substring that is an awesome string. An awesome string is a string that has an even number of each digit from 0-9. To solve this problem, we can use dynamic programming to keep track of the longest substring that is an awesome string at each index of the input string.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nWe can use dynamic programming to solve this problem. We can create an array, `dp`, of length 10 to keep track of the longest substring that is an awesome string at each index of the string. We can also keep track of the current mask of the substring, which is a bitmask that stores the count of each digit in the current substring. To calculate the longest awesome substring at each index, we can iterate through the string and update the mask and the `dp` array accordingly. At each index, we can check if the current substring is an awesome string. If it is, we can update the `dp` array and the longest substring length. \n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def longestAwesome(self, s: str) -> int:\n        n = len(s)\n        dp = [n + 1] * (1 << 10)\n        dp[0] = -1\n        res, mask = 0, 0\n        for i in range(n):\n            mask ^= 1 << int(s[i])\n            res = max(res, i - dp[mask])\n            for j in range(10):\n                res = max(res, i - dp[mask ^ (1 << j)])\n            dp[mask] = min(dp[mask], i)\n        return res\n```
['Hash Table', 'String', 'Dynamic Programming', 'Bit Manipulation', 'Python3']