100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\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```
['Python3']