#K79782. Robot Return to Origin

    ID: 35385 Type: Default 1000ms 256MiB

Robot Return to Origin

Robot Return to Origin

Given a sequence of moves for a robot represented by a string which only contains the characters L (Left), R (Right), U (Up) and D (Down), determine whether the robot returns to its starting position after completing all moves. Mathematically, let the horizontal displacement be \( x \) and the vertical displacement be \( y \). For each 'L', \( x \) decreases by 1; for each 'R', \( x \) increases by 1; for each 'U', \( y \) increases by 1; and for each 'D', \( y \) decreases by 1. The robot returns to the origin if and only if \( x = 0 \) and \( y = 0 \).

Your task is to implement a solution that reads the movement string from standard input and determines if the robot will return to the origin. Output "YES" if it does, otherwise output "NO".

inputFormat

The input consists of a single line containing a non-empty string that represents the sequence of moves. The string consists solely of the characters L, R, U, and D.

outputFormat

Output a single line containing either YES if the robot returns to its original position after completing all moves, or NO if it does not.

## sample
LRUD
YES

</p>