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

1 of 2
Laikoni
  • 26.4k
  • 7
  • 54
  • 116

Standard ML (MLton), 92 bytes

fun f(a::b:: #" "::r)=b::a:: #" "::f r|f(x::r)=x::f r|f r=r
fun$s=implode(f(explode(s^" ")))

Try it online! Example usage: $ "Flippign Lettesr Aroudn" yields "Flipping Letters Around ".

###Ungolfed

fun f (a :: b :: #" " :: r) = b :: a :: #" " :: f r
 | f (x :: r) = x :: f r
 | f r = r
fun g s = implode (f (explode (s ^ " ")))

[Try it online!][TIO-jbpmc805] [TIO-jbpmc805]: https://tio.run/##fU67CgIxEOzzFUO0SAp/4MDCxspvUCKXHIG82OQkhf8eE05EG6fY2R1mmM3eHbwrMbRm1gADoTBNuI@x4@CDSeK4KepbNiAGPDv/QNRPpv6xbSB0GzE2uhfkflifXJw1RH9F1/eece2dXErZHsrh1n2JbChiD352NiW7BFx0KToTThTXOXDZXg "Standard ML (MLton) – Try It Online"

Laikoni
  • 26.4k
  • 7
  • 54
  • 116

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