Python 1-liner
\nclass Solution:\n    def longestAwesome(self, s: str) -> int:\n        return reduce(lambda y,x:[max(y[0],x[0]-y[2][1023&y[1][x[0]]^(1<<x[1])]),*y[1:]],produc
```\nclass Solution:\n    def longestAwesome(self, s: str) -> int:\n        return reduce(lambda y,x:[max(y[0],x[0]-y[2][1023&y[1][x[0]]^(1<<x[1])]),*y[1:]],product(range(len(s)),range(11)),[0,(m:=[*accumulate(map(lambda x:1<<int(x),s),operator.xor)]),defaultdict(lambda:len(s),[*zip(m,count())][::-1]+[[0,-1]])])[0]\n```\n\nSolution with array is longer:\n```\n    def longestAwesome1(self, s: str) -> int:\n        mask, res, dp = 0, 0,  [-1] + [len(s)] *1023\n        for i in range(len(s)):\n            mask ^= 1 << int(s[i])\n            res = max(res, max(i - dp[1023&mask ^ (1 << j)]for j in range(11)))\n            dp[mask] = min(dp[mask], i)\n        return res\n ```\n
[]