Difficulty: Medium
Correct Answer: N
Explanation:
Introduction / Context:Swapping adjacent pairs is a frequent test of string manipulation and indexing under time pressure. After performing the swaps, you must locate a letter by relative position (“10th from the right”) rather than by index from the left, which increases the likelihood of off-by-one mistakes.
Given Data / Assumptions:
Concept / Approach:Execute pairwise swaps carefully, then convert the “10th from right” into a left index: for a 14-letter string, the 10th from the right is position 14 − 10 + 1 = 5 from the left.
Step-by-Step Solution:
Original indices (1..14): C(1) O(2) M(3) M(4) U(5) N(6) I(7) C(8) A(9) T(10) I(11) O(12) N(13) S(14).After swaps: (1↔2) → O C; (3↔4) → M M; (5↔6) → N U; (7↔8) → C I; (9↔10) → T A; (11↔12) → O I; (13↔14) → S N.Resulting string: O C M M N U C I T A O I S N.10th from right = 5th from left. The 5th character is N.Verification / Alternative check:Count from the right explicitly: N(1), S(2), I(3), O(4), A(5), T(6), I(7), C(8), U(9), N(10). The 10th from right is N, confirming the earlier index conversion.
Why Other Options Are Wrong:
Common Pitfalls:Miscounting from the right; forgetting to convert right-based indexing to left-based index correctly for even-length strings.
Final Answer:N
Discussion & Comments