#K52327. Back to the Starting Point

    ID: 29285 Type: Default 1000ms 256MiB

Back to the Starting Point

Back to the Starting Point

You are given a string representing a sequence of moves. Each move is represented by one character:

  • "L" means move left.
  • "R" means move right.
  • "U" means move up.
  • "D" means move down.

Your task is to determine if following the sequence of moves will return you to the starting point (i.e. the origin at \( (0,0) \)).

For example, for the input string "LRUD", each move cancels out, and you end up at the starting position. Hence, the output will be "Yes". If the moves do not cancel completely, then output "No".

inputFormat

The input consists of a single line, containing a non-empty string \( s \) with characters 'L', 'R', 'U', and 'D'. It is read from the standard input (stdin).

outputFormat

Output a single line with the answer: Yes if the sequence of moves returns to the starting point, or No otherwise. The output should be written to standard output (stdout).

## sample
LRUD
Yes