Skip to main content
2 of 3
added 261 characters in body
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372

MATL, 10 bytes

2Y2j97-sQ)

Try it online! Or verify all test cases.

Explanation

2Y2   % Push predefined literal: string 'abc···xzy'
      % STACK: 'abc···xyz'
j     % Take input as a string
      % STACK: 'abc···xyz', 'helloworld'
97-   % Push 97 (ASCII code of 'a'), and subtract element-wise
      % STACK: 'abc···xyz', [7 4 11 11 14 22 14 17 11 3]
s     % Sum
      % STACK: 'abc···xyz', 114
Q     % Add 1, and use as index (1-based, modular). Implicit display
      % STACK: 'k'
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372