~/algor $ cat problems/robot-harakati
Robot movement
Easy
1000 ms
64 MB
22%
A robot moves in four directions: s — north, j — south, q — east, g — west. The starting direction $c$ and a command $N$ are given: $0$ — keep moving (the direction does not change), $1$ — turn left by $90^{\circ}$, $2$ — turn right by $90^{\circ}$. Find the direction after the command.
Input
One line with a direction letter $c$ and an integer $N$.
Output
One letter: the robot's new direction (s, j, q or g).
Note
$c$ is s, j, q or g
$N \in \{0, 1, 2\}$
Examples
Input #1
s 1
Output #1
g
Input #2
s 2
Output #2
q