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
cnamejj
  • 2.9k
  • 10
  • 11

Ly, 25 bytes

irsp[' =:' *lf-o'?*+sp]lo

Try it online!

ir - read inp as codepoints on stack, reverse
 sp - stash the first char, then delete
 [ ] - loops over the 2-N chars on the stack
 ' = - push 0|1 from comparing curr char to " "
 : - copy the result
 ' * - multiply result w/ " " (32) 
 lf - pull prev char, flip top stack entries
 - - capitalizes if the curr char is " "
 o - write out char codepoint as a char
 '? - load 63 (diff between " " and "_")
 * - multiple by "is space" boolean
 + - converts " " chars to "_"
 sp - stash the curr char and delete from stack
 lo - print the last char (pulled up backup cell)
cnamejj
  • 2.9k
  • 10
  • 11

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