<doocs>0917.Reverse Only Letters_1.py
def reverseOnlyLetters( s: str) -> str:
    s = list(s)
    i, j = 0, len(s) - 1
    while i < j:
        while i < j and not s[i].isalpha():
            i += 1
        while i < j and not s[j].isalpha():
            j -= 1
        if i < j:
            s[i], s[j] = s[j], s[i]
            i, j = i + 1, j - 1
    return ''.join(s)
def sample_funcname ( var_0 : str ) -> str :
    var_0 = list ( var_0 )
    var_4 , var_7 = 0 , len ( var_0 ) - 1
    while var_4 < var_7 :
        while var_4 < var_7 and not var_0 [ var_4 ].isalpha ( ) :
            var_4 += 1
        while var_4 < var_7 and not var_0 [ var_7 ].isalpha ( ) :
            var_7 -= 1
        if var_4 < var_7 :
            var_0 [ var_4 ] , var_0 [ var_7 ] = var_0 [ var_7 ] , var_0 [ var_4 ]
            var_4 , var_7 = var_4 + 1 , var_7 - 1
    return ''.join ( var_0 )
