nice solution!!@@!!       
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 f(int a , int b , int& left){
        int d = min({a , b , left});
        int diff = abs(a-b) + 2*d;
        left -= d;
        return diff;
    }
    int maxDistance(string s, int k) {
        int MX = 0;
        unordered_map<char , int > freq;
        for(char c : s){
            freq[c] ++;
            int left = k;
            MX = max(MX , f(freq['N'] , freq['S'] , left) + f(freq['E'] , freq['W'] , left));
        }
        return MX;
    }
};
```
['C++']