How to switch chars within a string in an idiomatic or efficient way?

It's an interesting exercise because there are multiple ways to tackle it, either iteratively or not, and chars are more difficult to handle than in most other languages where they're simply bytes.

Someone else recently asked about it; you can see other approaches there: Review of pig latin converter (chapter 8)

1 Like