#C9953. Return to Origin

    ID: 54103 Type: Default 1000ms 256MiB

Return to Origin

Return to Origin

You are given a string moves consisting of the characters 'L', 'R', 'U', and 'D' that represent moves on a 2D plane. Starting at the origin \( (0,0) \), the moves change the position as follows:

  • L: move left (\( x = x - 1 \))
  • R: move right (\( x = x + 1 \))
  • U: move up (\( y = y + 1 \))
  • D: move down (\( y = y - 1 \))

Your task is to determine whether the sequence of moves returns the object to the origin \( (0, 0) \). In other words, after processing all the moves, check if the final coordinates are \( (0, 0) \).

inputFormat

The input consists of a single line containing a string composed only of the characters 'L', 'R', 'U', and 'D'.

outputFormat

Output a single line: print "True" if the object returns to the origin; otherwise, print "False".## sample

UD
True

</p>