Question
Reverse the Even Runs
Reverse every maximal contiguous run of even-valued nodes in a singly linked list, while keeping odd-valued nodes in their original relative positions.
Input
First line: KaTeX can only parse string typed expression.
Second line: list values from head to tail.
Output
Print the modified list.
Example
Input:
8
1 2 4 6 3 8 10 5Output:1 6 4 2 3 10 8 5