def ben_parentitzada_1(s):
    nt = 0
    no = 0
    for c in s:
        if c == '(':
            no = no + 1
        elif c == ')':
            nt = nt + 1
        if nt > no:
            return False
    return no == nt

def ben_parentitzada_2(s):
    nt = 0
    no = 0
    for i in range(len(s)):
        if s[i] == '(':
            no = no + 1
        elif s[i] == ')':
            nt = nt + 1
        if nt > no:
            return 'parèntesi tancat incorrecte', i
    if no == nt:
        return 'correcte'
    else:
        return 'més parèntesis oberts que tancats'
