#include <bits/stdc++.h>
using namespace std;
const int maxn=1e6+10;
int n,p[maxn];
string s;
stack <int> stk;
struct Result{
int ans,x,y;
};
Result cale(Result l,char op,Result r){
Result res;
if(op=='|'){
if(l.ans==1)res=l,res.y++;
else res=Result({r.ans,l.x+r.x,l.y+r.y});
}
else{
if(l.ans==0)res=l,res.x++;
else res=Result({r.ans,l.x+r.x,l.y+r.y});
}
return res;
}
Result solve(int st,int ed){
if(p[st]!=0&&p[st]==ed) return solve(st+1,ed-1);
Result v,res({0,0,0}),cur({1,0,0});
for(int i=st;i<=ed;i++){
if(s[i]=='('){
v=solve(i+1,p[i]-1;
i=p[i]+1;
}
else{
v=Result({s[i]-'0',0,0});
i++;
}
cur=cale(cur,'&',v);
if(i>ed||s[i]=='|'){
res=cale(res,'|',cur);
cur=Result({1,0,0});
}
}
return res;
}
int main(){
cin>>s;
n=s.length();
for(int i=0;i<n;i++){
if(s[i]=='(' ){
p[stk.top()]=i;
stk.pop();
}
}
Result res=solve(0,n-1);
cout<<res.ans<<endl;
cout<<res.x<<" "<<res.y<<endl;
return 0;
}