Functional Approach - Two Lines Only

```javascript []
const noChangeDists = (s, x = 0, y = 0, m = Math.abs) => [...s].map(d => 
    m(x += (d === 'E') - (d === 'W')) + m(y += (d === 'N') - (d === 'S'))
);

const maxDistance = (s, k, dists = noChangeDists(s)) => 
    Math.max(...dists.map((d, i) => Math.min(2 * k + d, i + 1)));

```
['JavaScript']