Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

3 of 6
added 84 characters in body
FrownyFrog
  • 3.8k
  • 1
  • 15
  • 20

J, 20 bytes

1&A.&.>@cut;@,.<@' '

Try it online!

###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

AltStyle によって変換されたページ (->オリジナル) /