#K60347. Simulate Bot Movement

    ID: 31066 Type: Default 1000ms 256MiB

Simulate Bot Movement

Simulate Bot Movement

You are given a string of commands, each of which is one of L, R, or G. The command G instructs the bot to move forward one unit in its current direction, while L and R cause the bot to turn 90° to the left or right respectively.

The bot starts at the coordinate \((0, 0)\) facing North (\(N\)). After processing all commands, output the final coordinates and the final facing direction. The directions are represented as follows:

  • \(N\) for North
  • \(E\) for East
  • \(S\) for South
  • \(W\) for West

Input: A single line containing a string of commands (possibly empty).

Output: Three values separated by spaces: the final x-coordinate, the final y-coordinate, and the final direction.

inputFormat

The input consists of a single line containing a string of characters. Each character will be one of L, R, or G. The string might be empty.

outputFormat

Output the final position and direction of the bot in the following format:

x y direction

Where x and y are the final coordinates and direction is one of N, E, S or W.

## sample
GGLLGG
0 0 S

</p>