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 Answer

added 790 characters in body
Source Link
Unrelated String
  • 23.9k
  • 3
  • 37
  • 61

Jelly, 26 bytes

".': "ðṖiⱮd2j@/ṙ1ŒHUż\/Ḅịḷ

Try it online!

Granted that is 2016 jelly

Newer answers could be shorter

-- lyxal

Just barely! Jelly changed a lot between 2016 and 2019, but the main byte saver here over Dennis' solution is just not having two separate string constants. There might be a shorter way to perform the core logic as well, but this kind of thing isn't really Jelly's forte--either rearranging multi-dimensional arrays or computing things under some transformation.

 iⱮ Find the 1-index of every character in
".': " Ṗ the string ".': " without the trailing space.
 d2 Divmod the indices by 2.
 / Reduce the list of [div, mod] pairs by
 j@ sticking the accumulator between the div and mod.
".': " ṖiⱮd2j@/ The result is the 's backwards followed by the .s.
 ṙ1 Rotate that 1 to the left,
 ŒH split it in half,
 ż / pair the elements of the halves
 U \ with the first half (un-)reversed,
 Ḅ convert each pair from binary,
".': "ð ịḷ and index into ".': ".

Jelly, 26 bytes

".': "ðṖiⱮd2j@/ṙ1ŒHUż\/Ḅịḷ

Try it online!

Granted that is 2016 jelly

Newer answers could be shorter

-- lyxal

Just barely! Jelly changed a lot between 2016 and 2019, but the main byte saver here over Dennis' solution is just not having two separate string constants. There might be a shorter way to perform the core logic as well, but this kind of thing isn't really Jelly's forte--either rearranging multi-dimensional arrays or computing things under some transformation.

Jelly, 26 bytes

".': "ðṖiⱮd2j@/ṙ1ŒHUż\/Ḅịḷ

Try it online!

Granted that is 2016 jelly

Newer answers could be shorter

-- lyxal

Just barely! Jelly changed a lot between 2016 and 2019, but the main byte saver here over Dennis' solution is just not having two separate string constants. There might be a shorter way to perform the core logic as well, but this kind of thing isn't really Jelly's forte--either rearranging multi-dimensional arrays or computing things under some transformation.

 iⱮ Find the 1-index of every character in
".': " Ṗ the string ".': " without the trailing space.
 d2 Divmod the indices by 2.
 / Reduce the list of [div, mod] pairs by
 j@ sticking the accumulator between the div and mod.
".': " ṖiⱮd2j@/ The result is the 's backwards followed by the .s.
 ṙ1 Rotate that 1 to the left,
 ŒH split it in half,
 ż / pair the elements of the halves
 U \ with the first half (un-)reversed,
 Ḅ convert each pair from binary,
".': "ð ịḷ and index into ".': ".
Source Link
Unrelated String
  • 23.9k
  • 3
  • 37
  • 61

Jelly, 26 bytes

".': "ðṖiⱮd2j@/ṙ1ŒHUż\/Ḅịḷ

Try it online!

Granted that is 2016 jelly

Newer answers could be shorter

-- lyxal

Just barely! Jelly changed a lot between 2016 and 2019, but the main byte saver here over Dennis' solution is just not having two separate string constants. There might be a shorter way to perform the core logic as well, but this kind of thing isn't really Jelly's forte--either rearranging multi-dimensional arrays or computing things under some transformation.

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