Swap the neighbours
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given array of n integers. Swap the neighbouring elements of array (a[0]
with a[1]
,a[2]
with a[3]
and so on). If there are odd number of elements, leave the last element of its place.
Input
First line contains number n. Next line contains n integers. All numbers do not exceed 100 by absolute value.
Output
Print the updated array.
Examples
Input #1
Answer #1
Submissions 8K
Acceptance rate 57%