<html>
<head>
<title>Segmentation Fault</title>
</head>
<body>
#include <bits/stdc++.h>
using namespace std;
bool compare(char a, char b) {
if (a == '|') return true;
return (b == '&');
}
int main() {
string s;
cin >> s;
stack < char > sta1;
stack < char > sta2;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '0' || s[i] == '1') {
sta2.push(s[i]);
} else if (s[i] == ')') {
while (sta1.top() != '(') {
sta2.push(sta1.top());
sta1.pop();
}
sta1.pop();
} else if (s[i] == '(') {
sta1.push(s[i]);
} else {
while (compare(s[i], sta1.top())) {
sta2.push(sta1.top());
sta1.pop();
}
sta1.push(s[i]);
}
}
while (!sta1.empty()) {
sta2.push(sta1.top());
sta1.pop();
}
char ans[int(2e6)];
return 0;
}
</body>
</html>