import java.util.*;
import java.lang.*;
class Main
{
{
String exampleStr
= "back-pay) zyzhk1219(17) zyzhk1329 zyzhk1595(15) zyzhk1988 zyzhk2004 zyzhk2131) jswioj((testsjkldf"; System.
out.
println(exampleStr
);
int parenLevel = 0;
for (int i = 0; i < exampleStr.length(); i++)
{
char c = exampleStr.charAt(i);
if (c == '(')
{
parenLevel++;
firstPass += c;
}
else if (c == ')')
{
if (parenLevel > 0)
{
parenLevel--;
firstPass += c;
}
}
else
{
firstPass += c;
}
}
parenLevel = 0;
for (int i = firstPass.length() - 1; i >= 0; i--)
{
char c = firstPass.charAt(i);
if (c == ')')
{
parenLevel++;
secondPass = c + secondPass;
}
else if (c == '(')
{
if (parenLevel > 0)
{
parenLevel--;
secondPass = c + secondPass;
}
}
else
{
secondPass = c + secondPass;
}
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CgpjbGFzcyBNYWluCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVN0cmluZyBleGFtcGxlU3RyID0gImJhY2stcGF5KSB6eXpoazEyMTkoMTcpIHp5emhrMTMyOSB6eXpoazE1OTUoMTUpIHp5emhrMTk4OCB6eXpoazIwMDQgenl6aGsyMTMxKSBqc3dpb2ooKHRlc3RzamtsZGYiOwoJCVN5c3RlbS5vdXQucHJpbnRsbihleGFtcGxlU3RyKTsKCQkKCQlTdHJpbmcgZmlyc3RQYXNzID0gIiI7CgkJaW50IHBhcmVuTGV2ZWwgPSAwOwoJCWZvciAoaW50IGkgPSAwOyBpIDwgZXhhbXBsZVN0ci5sZW5ndGgoKTsgaSsrKQoJCXsKCQkJY2hhciBjID0gZXhhbXBsZVN0ci5jaGFyQXQoaSk7CgkJCWlmIChjID09ICcoJykKCQkJewoJCQkJcGFyZW5MZXZlbCsrOwoJCQkJZmlyc3RQYXNzICs9IGM7C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