<doocs>1763.Longest Nice Substring_1.py
def longestNiceSubstring( s: str) -> str:
    n = len(s)
    ans = ''
    for i in range(n):
        lower = upper = 0
        for j in range(i, n):
            if s[j].islower():
                lower |= 1 << (ord(s[j]) - ord('a'))
            else:
                upper |= 1 << (ord(s[j]) - ord('A'))
            if lower == upper and j - i + 1 > len(ans):
                ans = s[i : j + 1]
    return ans
def sample_funcname ( var_0 : str ) -> str :
    var_3 = len ( var_0 )
    var_5 = ''
    for var_7 in range ( var_3 ) :
        var_10 = var_8 = 0
        for var_11 in range ( var_7 , var_3 ) :
            if var_0 [ var_11 ].islower ( ) :
                var_10 |= 1 << ( ord ( var_0 [ var_11 ] ) - ord ( 'a' ) )
            else :
                var_8 |= 1 << ( ord ( var_0 [ var_11 ] ) - ord ( 'A' ) )
            if var_10 == var_8 and var_11 - var_7 + 1 > len ( var_5 ) :
                var_5 = var_0 [ var_7 : var_11 + 1 ]
    return var_5
