// 2019 IUSB Programming Competition // Round 1 Problem 4 // Find out if the open and closed parentheses in a string are properly matching // Solution by Liguo Yu #include #include using namespace std; int main() { bool yes = true; string input; getline(cin, input); int x = 0; for (int i = 0; i < input.length(); i++) { if (input[i] == '(') x++; else if (input[i] == ')') x--; if (x < 0) yes = false; } if (x != 0) yes = false; if(yes == true) cout << "yes"; else cout << "no"; return 0; }