Final Destination
Practice
3.6 (77 votes)
Approved
Basic programming
Easy
Implementation
Open
Problem
83% Success 15665 Attempts 20 Points 5s Time Limit 256MB Memory 1024 KB Max Code

Bob and Khatu are stuck in matrix. The command center sent them a string which decodes to the their final destination. Since Bob and Khatu are not good at problem solving help them to figure out their final destination. They are initially at (0, 0). String contains L, R, U, D denoting left, right, up and down. In each command they will traverse 1 unit distance in the respective direction. For example if they are at (2, 0) and the command is they will go to (1, 0).

Input:

Input contains a single string.

Output:

Print the final destination location of Bob and Khatu.

Constraints:

1 ≤ |S| ≤ 105

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
308 votes
Tags:
Ad-HocAd-hocApprovedBasic ProgrammingEasyHiringOpenReadyRoot
Points:20
47 votes
Tags:
Basic ProgrammingEasyImplementation
Points:20
50 votes
Tags:
ApprovedBasic ProgrammingEasyHash MapsOpen