#P9022. Digit Processing
Digit Processing
Digit Processing
This problem consists of processing multiple data sets. For each data set, you will be given 5 digit characters. Let the digits be denoted as \(d_1, d_2, d_3, d_4, d_5\).
For each data set, perform the following:
- Compute \(S = d_1 + d_2\) (treating \(d_1, d_2\) as their integer values).
- If \(S\) is odd, then output
left
. - If \(S\) is a nonzero even number, then output
right
. - If \(S = 0\), then output the same result (
left
orright
) as produced by the previous data set. For the first data set, if \(S = 0\), assume the result isleft
.
After determining the appropriate word, output a single space followed by the concatenation of the last three digit characters \(d_3, d_4, d_5\).
Note: There is no count given for the number of data sets; you should process until the end of the input.
inputFormat
The input consists of multiple lines. Each line contains exactly 5 digit characters (without spaces) representing a data set.
outputFormat
For each input data set, output a line containing the result based on the above rules. Each line should have the determined word (left
or right
), then a space, then the last three digits from the input data set.
sample
12345
22468
left 345
right 468
</p>