#include using namespace std; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) // O(n) int dp[2][6][12525]; char s[12525]; char t[2][1252] = {"(*^^)", "(^^*)"}; int n; int main(){ scanf("%s",s); n = strlen(s); int ans[2] = {0,0}; REP(i,n)REP(x,2)REP(j,5){ if(t[x][j] == s[i]){ if(j==0){ dp[x][j+1][i+1] += 1; }else if(j==4){ ans[x] += dp[x][j][i]; dp[x][j][i+1] += dp[x][j][i]; }else{ dp[x][j+1][i+1] += dp[x][j][i]; } }else{ dp[x][j][i+1] += dp[x][j][i]; } } printf("%d %d\n",ans[1],ans[0]); return 0; }