SIMPLE SOLUTION || GREEDY APPRAOCH
Code
# Code
```cpp []
class Solution {
public:
    int maxDistance(string s, int k) {
        int n = s.length();
        unordered_map<char,int>mp;
        int res = 0;
        int K = k;
       for(int i=0; i<n; i++){
            k = K;
            mp[s[i]]++;
            int ans = 0;    
                // checking the intial answer without doing any operation
            ans = abs(mp['N'] - mp['S']) + abs(mp['E'] - mp['W']);
                // for checking the north and south operation 
            int maxi = max(mp['N'],mp['S']);
            int mini = min(mp['N'],mp['S']);
            int delta = min(mini, k);
            ans += 2*delta;
            k -= delta;
                // For checking the east west Opertion 
            maxi = max(mp['E'],mp['W']);
            mini = min(mp['E'],mp['W']);
            delta = min(mini, k);
            ans += 2*delta;
            k -= delta;

        res = max(res, ans);
       }     
       return res; 
    }
};
```
['Greedy', 'C++']