<doocs>0336.Palindrome Pairs_1.py
def palindromePairs( words: List[str]) -> List[List[int]]:
    d = {w: i for i, w in enumerate(words)}
    ans = []
    for i, w in enumerate(words):
        for j in range(len(w) + 1):
            a, b = w[:j], w[j:]
            ra, rb = a[::-1], b[::-1]
            if ra in d and d[ra] != i and b == rb:
                ans.append([i, d[ra]])
            if j and rb in d and d[rb] != i and a == ra:
                ans.append([d[rb], i])
    return ans
def sample_funcname ( var_0 : List [ str ] ) -> List [ List [ int ] ] :
    var_7 = { var_4 : var_5 for var_5 , var_4 in enumerate ( var_0 ) }
    var_8 = [ ]
    for var_5 , var_4 in enumerate ( var_0 ) :
        for var_12 in range ( len ( var_4 ) + 1 ) :
            var_13 , var_14 = var_4 [ : var_12 ] , var_4 [ var_12 : ]
            var_15 , var_16 = var_13 [ : : - 1 ] , var_14 [ : : - 1 ]
            if var_15 in var_7 and var_7 [ var_15 ] != var_5 and var_14 == var_16 :
                var_8.append ( [ var_5 , var_7 [ var_15 ] ] )
            if var_12 and var_16 in var_7 and var_7 [ var_16 ] != var_5 and var_13 == var_15 :
                var_8.append ( [ var_7 [ var_16 ] , var_5 ] )
    return var_8
