Easy Java 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
```java []
class Solution {
    public int furthestDistanceFromOrigin(String moves) {
        int leftCount = 0;
        int rightCount = 0;
        int underscoreCount = 0;

        // Traverse the string to count the characters
        for (char ch : moves.toCharArray()) {
            if (ch == 'L') leftCount++;
            else if (ch == 'R') rightCount++;
            else underscoreCount++; // count '_'
        }

        // Maximize the distance by aligning all underscores to the direction with greater magnitude
        return Math.abs(leftCount - rightCount) + underscoreCount;
    }
}

```
['Java']