<doocs>2047.Number of Valid Words in a Sentence_1.py
def check(token):
    hyphen = False
    for i, c in enumerate(token):
        if c.isdigit() or (c in '!.,' and i < len(token) - 1):
            return False
        if c == '-':
            if (
                hyphen
                or i == 0
                or i == len(token) - 1
                or not token[i - 1].islower()
                or not token[i + 1].islower()
            ):
                return False
            hyphen = True
    return True
def sample_funcname ( var_0 ) :
    var_2 = False
    for var_4 , var_5 in enumerate ( var_0 ) :
        if var_5.isdigit ( ) or ( var_5 in '!.,' and var_4 < len ( var_0 ) - 1 ) :
            return False
        if var_5 == '-' :
            if ( var_2 or var_4 == 0 or var_4 == len ( var_0 ) - 1 or not var_0 [ var_4 - 1 ].islower ( ) or not var_0 [ var_4 + 1 ].islower ( ) ) :
                return False
            var_2 = True
    return True
