#include <iostream> #include <string> #include <vector> using namespace std; int main() { string s; string a; while (cin >> s) { // 注意 while 处理多个 case for (int i=0; i<s.size(); i++) { switch (s[i]) { case '(': a.push_back(s[i]); break; case '[': a.push_back(s[i]); break; case ')': if (a[a.size()-1]=='(') { a.pop_back(); } else { a.push_back(s[i]); } break; case ']': if (a[a.size()-1]=='[') { a.pop_back(); } else { a.push_back(s[i]); } break; } } if (a.empty()) { cout<<"true"<<endl; } else { cout<<"false"<<endl; } } } // 64 位输出请用 printf("%lld")