Algorithms
Easy
2833
3019
Furthest Point From Origin
furthest-point-from-origin
"""
You are given a string moves of length n consisting only of characters 'L', 'R', and '_'. The string represents your movement on a number line starting from the origin 0.

In the ith move, you can choose one of the following directions:

 * move to the left if moves[i] = 'L' or moves[i] = '_'
 * move to the right if moves[i] = 'R' or moves[i] = '_'

Return the distance from the origin of the furthest point you can get to after n moves.

Example 1:

Input: moves = "L_RL__R"
Output: 3
Explanation: The furthest point we can reach from the origin 0 is point -3 through the following sequence of moves "LLRLLLR".

Example 2:

Input: moves = "_R__LL_"
Output: 5
Explanation: The furthest point we can reach from the origin 0 is point -5 through the following sequence of moves "LRLLLLL".

Example 3:

Input: moves = "_______"
Output: 7
Explanation: The furthest point we can reach from the origin 0 is point 7 through the following sequence of moves "RRRRRRR".


Constraints:

 * 1 <= moves.length == n <= 50
 * moves consists only of characters 'L', 'R' and '_'.
"""
class Solution:
    def furthestDistanceFromOrigin(self, moves: str) -> int:
        
You are given a string moves of length n consisting only of characters 'L', 'R', and '_'. The string represents your movement on a number line starting from the origin 0.

In the ith move, you can choose one of the following directions:

 * move to the left if moves[i] = 'L' or moves[i] = '_'
 * move to the right if moves[i] = 'R' or moves[i] = '_'

Return the distance from the origin of the furthest point you can get to after n moves.

Example 1:

Input: moves = "L_RL__R"
Output: 3
Explanation: The furthest point we can reach from the origin 0 is point -3 through the following sequence of moves "LLRLLLR".

Example 2:

Input: moves = "_R__LL_"
Output: 5
Explanation: The furthest point we can reach from the origin 0 is point -5 through the following sequence of moves "LRLLLLL".

Example 3:

Input: moves = "_______"
Output: 7
Explanation: The furthest point we can reach from the origin 0 is point 7 through the following sequence of moves "RRRRRRR".


Constraints:

 * 1 <= moves.length == n <= 50
 * moves consists only of characters 'L', 'R' and '_'.


Please complete the code below to solve above prblem:
```python
class Solution:
    def furthestDistanceFromOrigin(self, moves: str) -> int:
        
```

my_solution = Solution()

test_input = { "moves": "L_RL__R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "_R__LL_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 5

test_input = { "moves": "_______" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 7

test_input = { "moves": "L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "LL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 0

test_input = { "moves": "L_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 0

test_input = { "moves": "RR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "R_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "_L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "_R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "__" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LLL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "LLR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "LL_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "LRL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "LRR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "LR_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "L_L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "L_R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "L__" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "RLL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "RLR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "RL_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "RRL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "RRR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "RR_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "R_L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "R_R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "R__" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "_LL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "_LR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "_L_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "_RL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 1

test_input = { "moves": "_RR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "_R_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "__L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "__R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "___" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 3

test_input = { "moves": "LLLL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "LLLR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LLL_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "LLRL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LLRR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 0

test_input = { "moves": "LLR_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LL_L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "LL_R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LL__" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "LRLL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LRLR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 0

test_input = { "moves": "LRL_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LRRL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 0

test_input = { "moves": "LRRR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LRR_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LR_L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LR_R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "LR__" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "L_LL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "L_LR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "L_L_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "L_RL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "L_RR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "L_R_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "L__L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "L__R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "L___" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "RLLL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RLLR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 0

test_input = { "moves": "RLL_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RLRL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 0

test_input = { "moves": "RLRR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RLR_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RL_L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RL_R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RL__" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RRLL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 0

test_input = { "moves": "RRLR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RRL_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RRRL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RRRR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "RRR_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "RR_L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "RR_R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "RR__" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "R_LL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "R_LR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "R_L_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "R_RL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "R_RR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "R_R_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "R__L" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "R__R" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "R___" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "_LLL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "_LLR" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2

test_input = { "moves": "_LL_" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 4

test_input = { "moves": "_LRL" }
assert my_solution.furthestDistanceFromOrigin(**test_input) == 2