LogiQuest

479. Robot Return to Origin

EasySimulation

A robot starts at (0, 0) and follows moves U, D, L, R. Print YES if it ends at the origin, else NO.

Input format

One string of moves

Output format

YES or NO

Example 1

Input

UD

Output

YES

Example 2

Input

LL

Output

NO

Constraints

1 ≤ |moves| ≤ 2 × 10⁴

Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.

Loading the MyLoginn IDE…