Skip to main content
3 of 3
added 391 characters in body
ovs
  • 60.6k
  • 3
  • 47
  • 161

BQN, 30 28 bytesSBCS

{∾•Fmt¨×⊸/+˝(⥊𝕩-⌜"aA")=⌜↕26}

Run online!

↕26 Range from 0 to 25.
⥊𝕩-⌜"aA" Differences between each of the characters in the input and a or A.
=⌜ Equality table between those two vectors.
Sum the columns.
×⊸/ Keep the values with sign 1 (or: remove the zeros)
∾•Fmt¨ Convert each value to a string and join.

A slightly different approach using Bins Down at 29 bytes:

{∾•Fmt¨×⊸/»1↓/⁼27↕⊸⍋⥊𝕩-⌜"aA"}

Run online!

ovs
  • 60.6k
  • 3
  • 47
  • 161