Advertisement
Cheeel666

скобочная послед

Oct 17th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. s = input()
  2. balance = 0
  3. for i in range(len(s)):
  4. if s[i] == '(':
  5. balance +=1
  6. else:
  7. balance -=1
  8. if balance <0:
  9. break
  10.  
  11. if balance == 0:
  12. print("ALLRIGHT")
  13. else:
  14. print("WRONG")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement