Skip to main content
1 of 5
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#05AB1E, 61 bytes

•1∞Γ'иÛnuÞ\₂…•Ž8вв€SÐ)v.•6#&‘нδ•u3ôNèyè}'M3L×)Rεõš}`3Fâ}€˜JIå

Try it online or verify all test cases.

Explanation:

TODO: Will add an explanation tomorrow after I golfed it some more..

Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384