#include<bits/stdc++.h>
using namespace std;
long long n,a,b,p[1000005];
char c[1000005];
stack<long long>s;
bool dfs(long long l,long long r)
{
if(c[l]=='('&&c[r]==')'&&p[l]==r)
{
l++;
r--;
}
if(l==r)
{
if(c[l]=='0')return 0;
return 1;
}
for(int i=r;i>=l;i--)
{
if(c[i]==')')
{
i=p[i];
}
if(c[i]=='|')
{
bool x=dfs(l,i-1);
if(x)
{
a++;
return 1;
}
else{
bool y=dfs(i+1,r);
if(y)
{
return 1;
}
else
{
return 0;
}
}
}
}
for(int i=r;i>=l;i--)
{
if(c[i]==')')
{
i=p[i];
}
if(c[i]=='&')
{
bool x=dfs(l,i-1);
if(!x)
{
b++;
return 0;
}
else{
bool y=dfs(i+1,r);
if(!y)
{
return 0;
}
else
{
return 1;
}
}
}
}
}
int main()
{
scanf("%s",c+1);
n=strlen(c+1);
for(int i=1;i<=n;i++)
{
if(c[i]=='(')s.push(i);
if(c[i]==')')
{
p[s.top()]=i;
p[i]=s.top();
s.pop();
}
}
printf("%d\n",dfs(1,n));
printf("%lld %lld",b,a);
return 0;
}