Robot on a Line
A robot starts at position 0 on a number line and follows a command string: L moves it one step left, R one step right. Where does it end?
Input: one line with the command string S.
Output: the final position.
Constraints:
- 1 ≤ |S| ≤ 105
Sample Tests
Input 1
RRL
Output 1
1
Input 2
LLL
Output 2
-3
Discussion (opens after you solve — no spoilers before)
No comments yet.