Transform the Expression

#include
#include
#include
#include
#include
#include
#include

using namespace std;

typedef stack<int> s;
typedef vector<char> vi;
typedef vector<char>::iterator it;

int prCd(char ch){
  if(ch=='(')return 1; 
  if(ch=='+'||ch=='-')return 2;
  if(ch=='*'||ch=='/'||ch=='%')return 3;
  if(ch=='^')return 4;
  return 0;
}
int main(){
  int t;
  cin>>t;
  string str;
  while(t){
    cin>>str;
    s S;
    vi V(str.length());
    for(int i=0;i<str.length();i++){
      if((str[i]>='a' && str[i]<='z')||(str[i]>='1' && str[i]<='9')){
        V.push_back(str[i]);
      }else if(str[i]=='('){
        S.push(str[i]);
      }else if(str[i]==')'){
        while(S.top()!= '('){
          V.push_back(S.top());
          S.pop();
        }S.pop();
      }else{
        if(S.empty())
          S.push(str[i]);
        else{
          if(prCd(str[i])<=prCd(S.top())){
              V.push_back(S.top());
              S.pop();
              S.push(str[i]);
          }else{
              S.push(str[i]);
           }
        }
      }
    }
    while(!S.empty()){
      V.push_back(S.top());
      S.pop();
    }
    it i;
    for(i=V.begin();i!=V.end();i++){
      cout<<*i;
    }
    cout<<endl;
    t-=1;
  }
  return 0;
}

Output : Wrong Answer ??

//