Given the head of a singly linked list, group all the nodes with **odd indices** together followed by the nodes with **even indices**, and return the reordered list.
The **first** node is considered odd, and the **second** node is even, and so on.
Note that the relative order inside both the odd and even groups should remain as it was in the input.
### Constraints
- The number of nodes in the linked list is in the range `[0, 10^4]`.
- `-10^6 <= Node.val <= 10^6`
### Input Format
A single line containing space-separated integers representing the list.
### Output Format
Print the space-separated integers of the odd-even grouped list.
Sample Cases
Example 1Sample Case
Input: 1 2 3 4 5
Output: 1 3 5 2 4
Example 2Sample Case
Input: 2 1 3 5 6 4 7
Output: 2 3 6 7 1 5 4
Example 3Sample Case
Input: 1 1
Output: 1 1
Constraints
Runtime Limit: 2000 ms per test batch
Memory Limit: 256 MB
Standard I/O stream reading
Official submissions are evaluated against hidden test cases on the server to verify time & memory complexity.