#C6285. Array Modifier
Array Modifier
Array Modifier
You are given an array of integers and a mode string which can be either odd
or even
. Depending on the mode, you should modify the array as follows:
- If the mode is
odd
: increment every odd integer in the array by 1. - If the mode is
even
: decrement every even integer in the array by 1.
The program will read input from stdin and write the result to stdout as a space-separated list of integers.
If an invalid mode is provided, the program may print an error message or exit without modification.
inputFormat
The input consists of two lines:
- The first line contains a string that represents the mode (
odd
oreven
). - The second line contains a sequence of integers separated by spaces.
outputFormat
Output a single line containing the modified array as space-separated integers.
## sampleodd
1 2 3 4 5
2 2 4 4 6