#include <iostream>
#include <algorithm>
using namespace std;
using i64 = unsigned long long;

string s, emo;
int n;
vector<vector<i64>> dp;

// i文字目を見てる。状態は state
// パターン数を返す
i64 rec(int i, int state) {
  i64 &res = dp[i][state];
  if(res != -1) { return res; }
  if(i == n) { return res = state == 5; }
  res = rec(i+1, state);
  if(state == 0 && s[i] == emo[0]) { res += rec(i+1, 1); }
  else if(state == 1 && s[i] == emo[1]) { res = rec(i+1, 2); }
  else if(state == 2 && s[i] == emo[2]) { res = rec(i+1, 3); }
  else if(state == 3 && s[i] == emo[3]) { res = rec(i+1, 4); }
  else if(state == 4 && s[i] == emo[4]) { res += rec(i+1, 5); }
  return res;
}

i64 f(string s, string emo) {
  ::n = s.size();
  ::emo = emo;
  dp.assign(n+1, vector<i64>(6, -1));  
  return rec(0, 0);
}

int main(void) {
  ::s; cin >> s;
  i64 r0 = f(s, "(^^*)"),
      r1 = f(s, "(*^^)");
  printf("%lld %lld\n", r0, r1);
  return 0;
}