s = input() count = 0 for ch in s: if ch == '(': count += 1 else: count -= 1 if count < 0: print("False") break else: if count == 0: print("True") else: print("False")
To embed this project on your website, copy the following code and paste it into your website's HTML: