class Solution(object):

    def calculateTime(self, keyboard, word):
        li = []
        dic = {keyboard[i]: i for i in range(26)}
        res = 0
        cur = 0
        for c in word:
            res += abs(dic[c] - cur)
            cur = dic[c]
        return res

d4e2c4cf67511036833dec161f7d3c5d07f32bcb
<mask token>

class Solution(object):
    <mask token>

class Solution(object):

    def calculateTime(self, keyboard, word):
        li = []
        dic = {keyboard[i]: i for i in range(26)}
        res = 0
        cur = 0
        for c in word:
            res += abs(dic[c] - cur)
            cur = dic[c]
        return res
