Redundant paranthesis

whats the problem in this code
#include
#include
#include
using namespace std;
bool duplicate(string &str){
stack s;
for(int i=0;i<str.length();i++){
if(str[i]==’)’){
if(s.top()==’(’){

			return false;
		}
		else{
			while(s.top()!='('){
				s.pop();
			}
			s.pop();
          
		}
	}
	else{
	s.push(str[i]);
	}

}


return true;

}
int main() {
int t;
cin>>t;
for(int i=0;i<t;i++){
string s;
getline(cin,s);
if(duplicate(s)){
cout<<“Not Duplicates”<<endl;
}
else{
cout<<“Duplicate”<<endl;
}
}

return 0;

}

@deepakjumani09 does the doubt still exists in this problem ? i am asking because your submission score is 100 now.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.