~/algor $ cat problems/case-robot-burilib-yuradi
A robot that turns and walks
A robot stands at the point $(x; y)$ of the coordinate plane facing direction $c$. First it gets a turn command $k$: $0$ — no turn, $1$ — left by $90^{\circ}$ (counterclockwise), $2$ — right by $90^{\circ}$ (clockwise), $-1$ — a turn by $180^{\circ}$ (back). Then the robot walks $n$ steps in the new direction. Directions: s — north (each step increases $y$ by $1$), j — south ($y$ decreases by $1$), q — east ($x$ increases by $1$), g — west ($x$ decreases by $1$). Find the point where the robot stops and its final direction.
Input
One line: integers $x$ and $y$, a direction letter $c$ (s, j, q or g), integers $k$ and $n$.
Output
One line: the $x$ and $y$ coordinates of the point where the robot stops and the letter of its new direction.
Note
$-1000 \le x, y \le 1000$
$k \in \{-1, 0, 1, 2\}$
$0 \le n \le 1000$
Examples
1 2 s 2 3
4 2 q
0 0 q 1 4
0 4 s