<doocs>0640.Solve the Equation_1.py
def f(s):
    x = y = 0
    if s[0] != '-':
        s = '+' + s
    i, n = 0, len(s)
    while i < n:
        sign = 1 if s[i] == '+' else -1
        i += 1
        j = i
        while j < n and s[j] not in '+-':
            j += 1
        v = s[i:j]
        if v[-1] == 'x':
            x += sign * (int(v[:-1]) if len(v) > 1 else 1)
        else:
            y += sign * int(v)
        i = j
    return x, y
def sample_funcname ( var_0 ) :
    var_3 = var_1 = 0
    if var_0 [ 0 ] != '-' :
        var_0 = '+' + var_0
    var_6 , var_8 = 0 , len ( var_0 )
    while var_6 < var_8 :
        var_10 = 1 if var_0 [ var_6 ] == '+' else - 1
        var_6 += 1
        var_11 = var_6
        while var_11 < var_8 and var_0 [ var_11 ] not in '+-' :
            var_11 += 1
        var_13 = var_0 [ var_6 : var_11 ]
        if var_13 [ - 1 ] == 'x' :
            var_3 += var_10 * ( int ( var_13 [ : - 1 ] ) if len ( var_13 ) > 1 else 1 )
        else :
            var_1 += var_10 * int ( var_13 )
        var_6 = var_11
    return var_3 , var_1
