My issue
plz
My code
#include<iostream>
#include<string>
#include<stack>
#define ll long long int
using namespace std;
int main() {
// your code goes here
ll t;
cin>>t;
while(t-->0){
string s;
cin>>s;
stack<char>p;
string ans="";
for(ll i=0;i<s.length();i++){
if(s[i]=='('){
p.push(s[i]);
}
else if(s[i]=='+' ||s[i]=='-'||s[i]=='*'||s[i]=='/'||s[i]=='^'){
p.push(s[i]);
}
else if(isalpha(s[i])){
ans+=s[i];
}
else if(s[i]==')'){
while(p.top()!='(' && !p.empty()){
ans+=p.top();
}
if(!p.empty()){
p.pop();}
}
}
cout<<ans<<endl;
}
return 0;
}
Problem Link: ONP Problem - CodeChef