One-Finger Distance
One-Finger Distance
Given a linear keyboard of the letters of the alphabet, how many letters in total does your finger have to jump over in order to type a given word?
Consider the linear keyboard of the lowercase letters of the alphabet laid out like this:
The word "boost" has a one-finger distance of 18 because there are 13, 0, 4, 1 letters between b and o, o and o, o and s, s and t, respectively.
The word "wolfram" has a one-finger distance of 58. The string "abcdef" has a one-finger distance of 5.
Write code that finds the one-finger distance of a string
Write code that finds the one-finger distance of a string