#include <iostream>
using namespace std;
void revers(string & str) {
char a;
cin.get(a);
if (a != ')') revers(str);
else return;
str += a;
}
int main() {
string str = "";
char a;
while (cin.get(a))
if (a == '(') revers(str);
else str += a;
cout << str;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCByZXZlcnMoc3RyaW5nICYgc3RyKSB7CiAgY2hhciBhOwogIGNpbi5nZXQoYSk7CiAgaWYgKGEgIT0gJyknKSByZXZlcnMoc3RyKTsKICBlbHNlIHJldHVybjsKICBzdHIgKz0gYTsKfQoKaW50IG1haW4oKSB7CiAgc3RyaW5nIHN0ciA9ICIiOwogIGNoYXIgYTsKICB3aGlsZSAoY2luLmdldChhKSkKICAgIGlmIChhID09ICcoJykgcmV2ZXJzKHN0cik7CiAgICBlbHNlIHN0ciArPSBhOwogIGNvdXQgPDwgc3RyOwogIHJldHVybiAwOwp9