#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

using State = string::const_iterator;
class ParseError {};
using P = pair<int, int>;

//-------------------------------------

P orExpr(State &);
P andExpr(State &);
P term(State &);

P orExpr(State &now) {
    P a = andExpr(now);
    P res = P(-1, a.second);
    int tmp = a.first;
    while(*now == '|') {
        now++;
        P aa = andExpr(now);
        chmin(res.second, tmp + aa.second);
        tmp += aa.first;
    }
    res.first = tmp;
    return res;
}

P andExpr(State &now) {
    P t = term(now);
    P res = P(t.first, -1);
    int tmp = t.second;
    while(*now == '&') {
        now++;
        P tt = term(now);
        chmin(res.first, tmp + tt.first);
        tmp += tt.second;
    }
    res.second = tmp;
    return res;
}

P term(State &now) {
    if(*now == '(') {
        now++;
        P res = orExpr(now);
        now++;
        return res;
    } else {
        now++;
        return P(1, 1);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    State now = s.begin();
    P ans = orExpr(now);
    cout << ans.first << ' ' << ans.second << endl;
}
