#K66112. Path Tracer
Path Tracer
Path Tracer
You are given a series of instructions that control the movement of a point in a 3-dimensional space. The point starts at the origin \((0, 0, 0)\). Each instruction is represented by one of the following characters:
- U: Move up along the \(z\)-axis by 1 unit \( (0, 0, +1) \).
- D: Move down along the \(z\)-axis by 1 unit \( (0, 0, -1) \).
- F: Move forward along the \(y\)-axis by 1 unit \( (0, +1, 0) \).
- B: Move backward along the \(y\)-axis by 1 unit \( (0, -1, 0) \).
- L: Move left along the \(x\)-axis by 1 unit \( (-1, 0, 0) \).
- R: Move right along the \(x\)-axis by 1 unit \( (+1, 0, 0) \).
For each test case, compute the final position of the point after executing all movement instructions provided.
inputFormat
The input is given via standard input. The first line contains an integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains a string made up of characters from the set {U, D, F, B, L, R} representing the movement instructions for that test case.
T instructions_1 instructions_2 ... instructions_T
outputFormat
For each test case, output one line with three space-separated integers \(x\), \(y\), and \(z\) representing the final coordinates of the point after processing the instructions.
## sample2
UDFBLR
UDUDUDU
0 0 0
0 0 1
</p>