#include <bits/stdc++.h>
using namespace std;
char a[1000005];
map<char,int> v;
stack<char> op;
stack<bool> num;
int s1,s2;
void eval(){
bool res;
bool num1=num.top();
num.pop();
bool num2=num.top();
num.pop();
char OP=op.top();
op.pop();
if (OP=='&'){
if (num2==0){
s1++;
}
res=num1&num2;
}
if (OP=='|'){
if (num2==1){
s2++;
}
res=num1|num2;
}
num.push(res);
}
int main(int argc, const char * argv[]){
v['|']=1;
v['&']=2;
scanf ("%s",a+1);
int n=strlen(a+1);
int i;
for (i=1;i<=n;i++){
if (a[i]=='0'){
num.push(0);
}else if (a[i]=='1'){
num.push(1);
}else if (a[i]=='&'){
while (op.size() && op.top()!='(' && v[op.top()]>=2){
eval();
}
if (num.top()==0 && a[i+1]=='('){
s1++;
i++;
int k1=1,k2=0;
while (k2<k1){
i++;
if (a[i]=='('){
k1++;
}
if (a[i]==')'){
k2++;
}
}
}else{
op.push('&');
}
}else if (a[i]=='|'){
while (op.size() && op.top()!='(' && v[op.top()]>=1){
eval();
}
if (num.top()==1 && a[i+1]=='('){
s2++;
i++;
int k1=1,k2=0;
while (k2<k1){
i++;
if (a[i]=='('){
k1++;
}
if (a[i]==')'){
k2++;
}
}
}else{
op.push('|');
}
}else if (a[i]=='('){
op.push(a[i]);
}else if (a[i]==')'){
while(op.top() != '('){
eval();
}
op.pop();
}
}
while(op.size()) eval();
printf ("%d\n",num.top());
printf ("%d %d",s1,s2);
return 0;
}