#include using namespace std; #define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define FORR(i,l,n) for(int (i)=l;(i)<(int)(n);++(i)) const int Num = 3; //風船の数 std::array ar; std::string s; const std::string l = "(^^*)"; const std::string r = "(*^^)"; void solve() { cin >> s; //探索開始位置 int fI = 0; int cntL = 0; int cntR = 0; while ((fI = (s.find(l, fI))) != string::npos) { cntL++; fI += l.length(); } //初期化して fI = 0; while ((fI = (s.find(r, fI))) != string::npos) { cntR++; fI += r.length(); } cout << cntL << ' ' << cntR << endl; } int main() { ios::sync_with_stdio(false); solve(); return 0; }