//No.495 (^^*) Easy #include #include using namespace std; int main() { string S; cin >> S; string tmp_str; int face_[2] = {0,0}; bool load_f = false; for (int i = 0; i < S.length(); i++) { if (S[i] == '(') load_f = true; if (load_f) { tmp_str += S[i]; if (S[i] == ')')load_f = false; } if (tmp_str == "(^^*)") { face_[0]++; load_f = false; tmp_str.clear(); } else if (tmp_str == "(*^^)") { face_[1]++; load_f = false; tmp_str.clear(); } } cout << face_[0] << " " << face_[1] << endl; return 0; }