Advertisement
EWTD

Pre-View#4A

Nov 10th, 2022 (edited)
1,059
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. int main(){
  2.     std::string inp;
  3.     std::cin >> inp;
  4.     int a = 0;
  5.     for(const auto c: inp){
  6.         if( c < 0 ){ std::cout << "NOT OK"; exit(0);}
  7.         a += (c == '(' ? 1 : -1);
  8.     }
  9.     std::cout << (a == 0? "OK": "NOT OK");
  10.     return 0;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement