<qiyuangong>243_Shortest_Word_Distance_1.py
def shortestDistance( words, word1, word2):
    indexes = []
    for index, word in enumerate(words):
        if word1 == word:
            indexes.append((index, 1))
        elif word2 == word:
            indexes.append((index, 2))
    ls, min_range = len(indexes), len(words)
    for i in range(ls - 1):
        if indexes[i][1] == indexes[i + 1][1]:
            continue
        curr_range = abs(indexes[i][0] - indexes[i + 1][0])
        if curr_range < min_range:
            min_range = curr_range
    return min_range
def sample_funcname ( var_0 , var_1 , var_2 ) :
    var_3 = [ ]
    for var_5 , var_6 in enumerate ( var_0 ) :
        if var_1 == var_6 :
            var_3.append ( ( var_5 , 1 ) )
        elif var_2 == var_6 :
            var_3.append ( ( var_5 , 2 ) )
    var_11 , var_12 = len ( var_3 ) , len ( var_0 )
    for var_14 in range ( var_11 - 1 ) :
        if var_3 [ var_14 ] [ 1 ] == var_3 [ var_14 + 1 ] [ 1 ] :
            continue
        var_17 = abs ( var_3 [ var_14 ] [ 0 ] - var_3 [ var_14 + 1 ] [ 0 ] )
        if var_17 < var_12 :
            var_12 = var_17
    return var_12
