#include "bits/stdc++.h" #define _CRT_SECURE_NO_WARNINGS #define rep(i,n) for(int i = 0;i < n;i++) #define REP(i,n,k) for(int i = n;i < k;i++) #define P(p) cout << (p) << endl; #define sP(p) cout << setprecision(15) << fixed << p << endl; #define vi vector #define mp(a,b) make_pair(a,b) using namespace std;typedef long long ll;typedef unsigned long long ull;int dx[] = { 1, -1 , 0 , 0};int dy[] = { 0, 0, 1, -1}; void solve() { string s; cin >> s; int kome = 0,niko = 0,komeikou = 0,l = 0,r = 0; bool left = false,right = false; rep(i,s.length()){ if(s[i] == '('){ kome = 0;komeikou = 0;niko = 0;left = false;right = false; REP(j,i+1,s.length()){ if(s[j] == '*'){ kome++; if(niko >= 2){ left = true; } }else if(s[j] == '^'){ niko++; if(kome >= 1){ komeikou++; } if(komeikou >= 2){ right = true; } }else if(s[j] == ')'){ if(left)l++; if(right)r++; } } } } cout << l << " " << r << endl; } int main() { solve(); return 0; }