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;
}