J, 20 bytes
1&A.&.>@cut;@,.<@' '
###How it works
cut Split on spaces
&.>@ For each string
1&A. Swap the last two letters
<@' ' A single space
;@,. Append to each and unbox
I wonder if it’s shorter to simply calculate the permutation for the entire input.
FrownyFrog
- 3.8k
- 1
- 15
- 20