#include #include int main(void) { int a = 0,b = 0,l,i,j,ca,cb; char s[16384],sa[8] = "^^*-",sb[8] = "*^^-"; scanf("%s",s); l = strlen(s); for(i = 0;i < l;i++){ if(s[i] != '('){continue;} ca = 0;cb = 0; for(j = i + 1;j < l;j++){ if(s[j] == sa[ca]){ca++;} if(s[j] == sb[cb]){cb++;} if(s[j] == ')'){ if(ca >= 3){a++;} if(cb >= 3){b++;} } } } printf("%d %d\n",a,b); return 0; }