Given an input of an all-lowercase string
[a-z], output the total distance between the letters.
Input: golf Distance from g to o : 8 Distance from o to l : 3 Distance from l to f : 6 Output: 17
- Standard loopholes forbidden
- This is code-golf - shortest answer in bytes wins.
- The alphabet can be traversed from either direction. You must always use the shortest path. (i.e the distance between
Input: aa Output: 0 Input: stack Output: 18 Input: zaza Output: 3 Input: valleys Output: 35