Cute 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
```python3 []
class Solution:
    def maxDistance(self, s: str, k: int) -> int:
        a = [0 for i in range(len(s))]
        e,w,n,t = 0,0,0,0
        diff = 0
        for i in range(len(s)):
            if s[i] == 'N':
                n+=1
            elif s[i] == 'S':
                t+=1
            if s[i] == 'E':
                e+=1
            if s[i] == 'W':
                w+=1
            a[i] = abs(n-t) + abs(e-w) + diff
            if(a[i] < a[i-1] and k):
                a[i] += 2
                diff += 2
                k-=1
        return max(a)

        


```
['Python3']