function solution(inputString) {
//For single level depth
let stack=[];
let final=inputString.split(''), left,right;
for(let x=0; x<inputString.length; x++){
if(inputString[x]=="("){
stack.push(x);
}
else if(inputString[x]==")"){
left=stack.pop()+1;
right=x-1;
while(left < right){
let temp=final[left];
final[left]=final[right];
final[right]=temp;
left++;
right--;
}
}
// else{
// if(stack.length==0){
// final+=inputString[x];
// }
}
return final.filter(x=>x.match(/[a-z]/i)).join('')
}
console.log(solution("(abc(tzx(yz)))"))