<doocs>1165.Single-Row Keyboard_1.py
def calculateTime( keyboard: str, word: str) -> int:
    index = {c: i for i, c in enumerate(keyboard)}
    res = t = 0
    for c in word:
        res += abs(index[c] - t)
        t = index[c]
    return res
def sample_funcname ( var_0 : str , var_2 : str ) -> int :
    var_7 = { var_4 : var_5 for var_5 , var_4 in enumerate ( var_0 ) }
    var_10 = var_8 = 0
    for var_4 in var_2 :
        var_10 += abs ( var_7 [ var_4 ] - var_8 )
        var_8 = var_7 [ var_4 ]
    return var_10
