#include<bits/stdc++.h>
#define int long long
using namespace std;
string s;
int n;
string dfs(int l,int r){
string tmp="";
for(int i=l;i<=r;i++){
if(s[i]=='('){
int cnt=0,pre;
for(int j=i;j<=n;j++){
if(s[j]=='(')cnt++;
if(s[j]==')')cnt--;
if(cnt==0){
pre=j;
break;
}
}
string t=dfs(i+1,pre-1);
int f=t.size();
for(int k=f-1;k>=0;k--){
if(t[k]>='A'&&t[k]<='Z')t[k]=t[k]-'A'+'a';
else t[k]=t[k]-'a'+'A';
tmp+=t[k];
}
i=pre;
}else{
tmp+=s[i];
}
}
return tmp;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>s;
n=s.size();
s=" "+s;
cout<<dfs(1,n)<<'\n';
return 0;
}