#C14255. Back to Start

    ID: 43884 Type: Default 1000ms 256MiB

Back to Start

Back to Start

You are given a string moves consisting of the characters 'L', 'R', 'U', and 'D', each representing a move left, right, up, and down respectively. Starting from the origin \( (0,0) \), your task is to determine whether the series of moves returns you to the starting point.

For example, if you move 'U' (up) then 'D' (down), you end up at the origin. In contrast, if you only move 'L' (left) four times, you will not return to the origin.

More formally, if the final coordinates \( (x,y) \) satisfy \( x=0 \) and \( y=0 \) after processing all movements, then the answer is True; otherwise, it is False.

inputFormat

The input consists of a single line containing a non-empty string moves made up only of the characters 'L', 'R', 'U', and 'D'.

Note: The input is read from standard input (stdin).

outputFormat

Output a single line: True if the moves return to the starting point \( (0, 0) \), otherwise False. The output should be written to standard output (stdout).

## sample
UD
True