#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

string s;

P calc(int &i){
    vector<P> pa, po;
    while (i < s.length() && s[i] != ')'){
        P p;
        if (s[i] == '('){
            i++;
            p = calc(i);
        }else{
            p = make_pair(1, 1);
        }
        i++;
        pa.push_back(p);
        if (s[i] == ')') break;
        if (i < s.length() && s[i] == '|'){
            P tmp(1e9, 0);
            int s = 0;
            for (P p : pa){
                chmin(tmp.first, p.first + s);
                tmp.second += p.second;
                s += min(p.first, p.second);
            }
            po.push_back(tmp);
            pa.clear();
        }
        i++;
    }
    {
        P tmp(1e9, 0);
        int s = 0;
        for (P p : pa){
            chmin(tmp.first, p.first + s);
            tmp.second += p.second;
            s += min(p.first, p.second);
        }
        po.push_back(tmp);
        pa.clear();
    }
    P ret(0, 1e9);
    int s = 0;
    for (P p : po){
        ret.first += p.first;
        chmin(ret.second, p.second + s);
        s += min(p.first, p.second);
    }
    return ret;
}

int main() {
    cin >> s;
    int i = 0;
    P p = calc(i);
    cout << p.first << " " << p.second << endl;

    return 0;
}

