#include using namespace std; int main(){ string s; cin >> s; int left=0, right=0; for(int i=0; s[i]!='#'; i++){ if(s[i]=='*'){ if(s[i-1]=='^'){ left++; } } if(s[i]=='*'){ if(s[i-1]=='('){ right++; } } } cout << left << ' ' << right << endl; return 0; }