#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(int i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(int i = m;i >= n;--i) #define INF INT_MAX/2 using namespace std; using ll = long long; using R = double; const ll MOD = 1e9 + 7; const ll inf = 1LL << 50; struct edge { ll from; ll to; ll cost; }; int main(){ string s; cin >> s; int n = s.size(); int r = 0; int l = 0; rep(i, 0, n) { if (s[i] == '(') { int rc = 0; int lc = 0; rep(j, i + 1, n) { if (s[j] == '^') { if (rc == 1 || rc == 2)rc++; if (lc == 0 || lc == 1)lc++; } else if(s[j] == '*'){ if (rc == 0)rc++; if (lc == 2)lc++; } else if (s[j] == ')') { if (rc == 3)r++; if (lc == 3)l++; } } } } cout << l << " " << r << endl; return 0; }