include [HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
define inf 0x3f3f3f3f
typedef long long ll;
typedef pair[HTML_REMOVED] P;
define pi 3.141592653589793238
int mov[4][2]= {{-1,0},{0,1},{1,0},{0,-1}};
int month[13]= {0,31,0,31,30,31,30,31,31,30,31,30,31};
const int N=10100;
const int M=1e9+7;
int n;
string s;
int dfs(int &i){
int x=0;
int res=0;
bool flag=false;
while(i<n){
if(s[i]=='x'){
x++;
}else if(s[i]=='|'){
res=max(res,x);
x=0;
flag=true;
}else if(s[i]=='('){
x+=dfs(++i);
}else if(s[i]==')'){
if(flag){
res=max(res,x);
}else{
res=x;
}
return res;
}
i++;
}
if(flag){
res=max(res,x);
}else{
res=x;
}
return res;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
while(cin>>s){
n=s.length();
int i=0;
cout<<dfs(i)<<endl;
}
return 0;
}