pars_str = input()


def solution():
    if not pars_str:
        return 'NO'
    w_sum = 0
    for sym in pars_str:
        if sym == '(':
            w_sum += 1
        else:
            w_sum -= 1
            if w_sum < 0:
                return 'NO'
    if w_sum == 0:
        return 'YES'
    return 'NO'


print(solution())

36fd09743329d834ce54679d1fc5d144829bc72b
<mask token>

<mask token>


def solution():
    if not pars_str:
        return 'NO'
    w_sum = 0
    for sym in pars_str:
        if sym == '(':
            w_sum += 1
        else:
            w_sum -= 1
            if w_sum < 0:
                return 'NO'
    if w_sum == 0:
        return 'YES'
    return 'NO'


<mask token>

<mask token>


def solution():
    if not pars_str:
        return 'NO'
    w_sum = 0
    for sym in pars_str:
        if sym == '(':
            w_sum += 1
        else:
            w_sum -= 1
            if w_sum < 0:
                return 'NO'
    if w_sum == 0:
        return 'YES'
    return 'NO'


print(solution())

pars_str = input()


def solution():
    if not pars_str:
        return 'NO'
    w_sum = 0
    for sym in pars_str:
        if sym == '(':
            w_sum += 1
        else:
            w_sum -= 1
            if w_sum < 0:
                return 'NO'
    if w_sum == 0:
        return 'YES'
    return 'NO'


print(solution())
