#include #include #include #include #include bool areBracketsCorrect (std::vector vec1){ std::stack st; bool isEmpty; for(size_t i = 0; i < vec1.size(); i++){ if(vec1[i] == '('){ st.push(vec1[i]); } } for(size_t j = 0; j < vec1.size(); j++){ if(vec1[j] == ')'){ st.pop(); } } if(st.empty() == 1){ isEmpty = 1; } else { isEmpty = 0; } return isEmpty; } int main (){ std::string expression; std::cin >> expression; std::istringstream exprStream(expression); std::vector vecOfChar; char currentChar; while(exprStream >> currentChar){ vecOfChar.push_back(currentChar); } if(areBracketsCorrect(vecOfChar) == 1){ std::cout << "correct" << std::endl; } else { std::cout << "incorrect" << std::endl; } return 0; }