Pairwise Swap
Swap characters pairwise: positions 1↔2, 3↔4, ... A trailing unpaired character stays put.
Input: one line with the string S.
Output: the pair-swapped string.
Constraints:
- 1 ≤ |S| ≤ 104
Sample Tests
Input 1
abcde
Output 1
badce
Input 2
ab
Output 2
ba
Discussion (opens after you solve — no spoilers before)
No comments yet.