#include #define rep(i,a,b) for(int i=int(a);i> S; int N = S.length(); rep(k,0,2){ ll cnt = 0; rep(i,0,N){ if(S[i] != '(')continue; string str[] = {"^^*" , "*^^" }; int c = 0; rep(j,i+1,N){ if(c < 3){ c += (S[j] == str[k][c]); }else{ cnt += (S[j] == ')'); } } } cout << cnt << " \n"[k == 1]; } }