Skip to main content
2 of 2
Add TIO link.
user202729
  • 17.4k
  • 2
  • 37
  • 70

Wolfram Language, 117 bytes

StringReplace[RegularExpression["\\b[[:alpha:]]{2,}\\b"]:>StringDrop[StringInsert["$0",StringTake["$0",{-1}],-3],-1]]

Try it online!

Applied to the test strings.

StringReplace[
  RegularExpression["\\b[[:alpha:]]{2,}\\b"] :> 
   StringDrop[StringInsert["$0", StringTake["$0", {-1}], -3], -1]] /@
 {"Thansk", "Youer welcoem", "This is an apple", 
  "Flippign Lettesr Aroudn", "tHe oDd chALlEneg wiht swappde lettesR"} // Column
Thanks
Youre welcome
Thsi si na appel
Flipping Letters Around
teH odD chALlEnge with swapped letteRs
Edmund
  • 141
  • 5