Simple Simulation Greedily
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
```python3 []
class Solution:
    def maxDistance(self, s: str, k: int) -> int:
        helpers=['NE','NW','SE','SW']
        op={'N':'S','S':'N','E':'W','W':'E'}
        maxi=0
        def solve(s,k,st,op):
            cur=0
            ans=0
            for i in range(len(s)):
                if(s[i] in st):
                    cur+=1 
                else:
                    if(k>0):
                        cur+=1
                        k-=1
                    else:
                        cur-=1
                ans=max(ans,cur)
            return ans
        for i in range(4):
            maxi=max(maxi,solve(s,k,helpers[i],op))
        return maxi

        
```
['Python3']