Good question
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int longestAwesome(string s) {
        int mask = 0;
        unordered_map<int, int> bitmasks;

        int n = s.length();

        int ans = 1;
        bitmasks[mask] = -1;
        for(int i=0;i<n;i++) {
            mask = mask ^ (1 << s[i]-'0');
            if(bitmasks.find(mask) != bitmasks.end()) {
                ans = max(abs(bitmasks[mask] - i), ans);
            } else {
                bitmasks[mask] = i;
            }
            for(int j=0;j<10;j++) {
                int newMask = mask ^ (1 << j);
                if(bitmasks.find(newMask) != bitmasks.end()) {
                    ans = max(abs(bitmasks[newMask] - i), ans);
                }
            }

        }
        return ans;
    }
};
```
['C++']