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

3 of 3
deleted 74 characters in body
ბიმო
  • 17k
  • 3
  • 43
  • 106

Haskell, (削除) 60 (削除ここまで) 59 bytes

(init<>reverse).(scanl(?)<*>tail)
a?_=do u<-a;u:[' '|' '<u]

Try it online!

Explanation

For a string (eg. "abc") we apply first

scanl (?) <*> tail

which is the same as

\str -> scanl (?) str (tail str)

This repeatedly applies (?) (appends a space to each character in the range [33..]) to the str until there are that many strings as str has characters: ["abc","a b c ", "a b c "]

Now we only need to concatenate the result (minus the last element) with its reversed counter part:

init<>reverse
ბიმო
  • 17k
  • 3
  • 43
  • 106

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