#C9798. Split List by Index Parity
Split List by Index Parity
Split List by Index Parity
You are given a list of integers. Your task is to split the list into two lists:
- The first list contains elements located at even indices (0, 2, 4, ...).
- The second list contains elements located at odd indices (1, 3, 5, ...).
Note: The indices are 0-based. For example, given the list \([2, 1, 4, 3, 6, 5]\), the output lists should be \([2, 4, 6]\) and \([1, 3, 5]\) respectively.
inputFormat
The input consists of two lines:
- The first line contains a single integer \(n\) representing the number of elements in the list.
- The second line contains \(n\) space-separated integers.
outputFormat
Output exactly two lines:
- The first line contains the elements at even indices (0, 2, 4, ...), separated by a single space.
- The second line contains the elements at odd indices (1, 3, 5, ...), separated by a single space.
If there are no elements for a particular line, output an empty line.
## sample6
2 1 4 3 6 5
2 4 6
1 3 5
</p>