Skip to main content
-2 bytes
Source Link
oeuf
  • 1.8k
  • 4
  • 18

K (ngn/k), 1616 14 bytes

`c$97+26!+/-97+'97!

Try it online!Try it online!

-2 bytes thanks to coltim!

Explanation:

`c$97+26!+/-97+'97!  Main function. Takes implicit input
            97!  Modulo 'by 97 Forto each character in the string
           -97+   + -97 to each of them to convert them into the 0..25 system
                  (In K, every character in a string is also an ASCII charcode)
         +/       Sum
      26!         Modulo by 26
   97+            + 97 to each of them (to convert them back to ASCII charcode)
`c$               And convert them back to characters

K (ngn/k), 16 bytes

`c$97+26!+/-97+'

Try it online!

Explanation:

`c$97+26!+/-97+'  Main function. Takes implicit input
               '  For each character in the string
           -97+   + -97 to each of them to convert them into the 0..25 system
                  (In K, every character in a string is also an ASCII charcode)
         +/       Sum
      26!         Modulo by 26
   97+            + 97 to each of them (to convert them back to ASCII charcode)
`c$               And convert them back to characters

K (ngn/k), 16 14 bytes

`c$97+26!+/97!

Try it online!

-2 bytes thanks to coltim!

Explanation:

`c$97+26!+/97!  Main function. Takes implicit input
           97!  Modulo by 97 to each character in the string
                to convert them into the 0..25 system
                (In K, every character in a string is also an ASCII charcode)
         +/     Sum
      26!       Modulo by 26
   97+          + 97 to each of them to convert them back to ASCII charcode
`c$             And convert them back to characters
Source Link
oeuf
  • 1.8k
  • 4
  • 18

K (ngn/k), 16 bytes

`c$97+26!+/-97+'

Try it online!

Explanation:

`c$97+26!+/-97+'  Main function. Takes implicit input
               '  For each character in the string
           -97+   + -97 to each of them to convert them into the 0..25 system
                  (In K, every character in a string is also an ASCII charcode)
         +/       Sum
      26!         Modulo by 26
   97+            + 97 to each of them (to convert them back to ASCII charcode)
`c$               And convert them back to characters