Using Counter to Track Moves & Compute Maximum Distance
CodeCode


# Code
```python3 []
class Solution:
    def furthestDistanceFromOrigin(self, moves: str) -> int:
        count=Counter(moves)
        return abs(count['L']-count['R'])+count['_']
```

# Code
```java []
class Solution {
    public int furthestDistanceFromOrigin(String moves) {
        int left_count = 0, right_count = 0, lrcount = 0;
        for (char move : moves.toCharArray()) {  
            if (move=='L') {
                left_count++;
            } 
            else if (move=='R') {
                right_count++;
            } 
            else { 
                lrcount++;
            }
        }
        return Math.abs(left_count - right_count) + lrcount;
    }
}
```
['String', 'Counting', 'Java', 'Python3']