#C11038. Robot Return to Origin
Robot Return to Origin
Robot Return to Origin
The task is to determine whether a robot returns to the origin after following a series of moves. The robot starts at the coordinate \( (0,0) \) and makes moves according to the characters provided in the input string. Each character in the string represents a move:
- U : move up
- D : move down
- L : move left
- R : move right
After executing all moves, the robot returns to the origin if and only if \( x=0 \) and \( y=0 \). Your task is to output True
if the robot returns to the origin, and False
otherwise.
inputFormat
The input consists of a single line containing a string \( s \) (where \( 1 \leq |s| \leq 10^4 \)) composed of characters 'U', 'D', 'L', and 'R' representing the moves of the robot.
Note: The input should be read from standard input (stdin).
outputFormat
Output a single line containing either True
or False
. This output should be printed to standard output (stdout).
UD
True