Skip to main content
Add TIO link.
Source 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

Wolfram Language, 117 bytes

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

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

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
Source Link
Edmund
  • 141
  • 5

Wolfram Language, 117 bytes

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

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