Simple solution in Java. Beats 100 %
Complexity

Time complexity:
O(n)


Space complexity:
O(1)

Code
# Complexity
- Time complexity:
O(n)

- Space complexity:
O(1)

# Code
```java []
class Solution {
    public int furthestDistanceFromOrigin(String moves) {
        int LCount = 0, RCount = 0, dashCount = 0;
        for (int i = 0; i < moves.length(); i++) {
            if (moves.charAt(i) == 'L') {
                LCount++;
            } else if (moves.charAt(i) == 'R') {
                RCount++;
            } else {
                dashCount++;
            }
        }
        return LCount >= RCount ? LCount - RCount + dashCount : RCount - LCount + dashCount;
    }
}
```
['Java']