#include <bits/stdc++.h>
#include <cstring>
using namespace std;
string str;
int i = 0;
int dfs()
{
    int mmax = 0, cnt = 0;
    while (i < str.size())
    {
        if (str[i] == '(')
        {
            i++;
            cnt += dfs();
        }
        else if (str[i] == 'x')
        {
            cnt++;
            i++;
        }
        else if (str[i] == '|')
        {
            mmax = max(cnt, mmax);
            i++;
            cnt = 0;
        }
        else
        {
            i++;
            break;
        }
    }
    return mmax = max(mmax, cnt);
}
int main()
{
    cin >> str;
    cout << dfs();
}
