string = input()
count_a= string.count ("(")
count_b= string.count (")")
if count_a == count_b:
    print("формула верна")
else:
    print("Формула не верна")

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: