Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <vector>

using namespace std;

vector<string> toReversePorland(string str){

  vector<string> hand;
  vector<string> side;

  // ÊàtO
  bool isInside = false;    

  for(int i = 0; i < str.size(); i++){
    //    cout << str[i] << endl;
    if(str[i] >= '0' && str[i] <= '9'){
      string num;
      while(i < str.size()){
	if(str[i] < '0' || str[i] > '9'){
	  break;
	}
	num += str[i];
	i++;
      }
      hand.push_back(num);
      i--;
    }
    else if(str[i] == '('){
      isInside = true;
      string tmp;
      tmp += str[i];
      side.push_back(tmp);
    }
    else if(str[i] == ')'){
      // EÊÜÅZqðêÂ¸Âè³Éß·
      for(int j = side.size()-1 ; ;j--){
	if(side[j] == "("){
	  if(j != 0){
	    vector<string> tmp;
	    for(int k = 0; k < j; k++){
	      tmp.push_back(side[k]);
	    }
	    side = tmp;
	  }
	  else
	    side.clear();
	  break;
	}
	else{
	  string tmp = side[j];
	  hand.push_back(tmp);
	}
      }
      isInside = false;
    }
    else{
      if(side.size() == 0){
	string tmp;
	tmp += str[i];
	side.push_back(tmp);
      }
      else if(str[i] == '+' || str[i] == '-'){
	if(side[side.size()-1] == "*" || side[side.size()-1] == "/"){
	  hand.push_back(side[side.size()-1]);
	  string tmp;
	  tmp += str[i];
	  side[side.size()-1] = tmp;
	}
	else{
	  string tmp;
	  tmp += str[i];
	  side.push_back(tmp);
	}
      }
      else{
	if(side[side.size()-1] == "*" || side[side.size()-1] == "/"){
	  hand.push_back(side[side.size()-1]);
	  string tmp;
	  tmp += str[i];
	  side[side.size()-1] = string(tmp);
	}
	else{
	  string tmp;
	  tmp += str[i];
	  side.push_back(tmp);
	}
      }
    }
  }

  for(int i = side.size()-1; i >= 0; i--){
    hand.push_back(string(side[i]));
  }
  
  return hand;
}


int calc(vector<string> str){
  stack<int> st;
  for(int i = 0; i < str.size(); i++){
    if(str[i] == "+" || str[i] == "-" || str[i] == "*" || str[i] == "/"){
      int val[2];
      val[0] = st.top();
      st.pop();
      val[1] = st.top();
      st.pop();
      if(str[i] == "+"){
	st.push(val[0] + val[1]);
      }
      if(str[i] == "-"){
	st.push(val[1] - val[0]);
      }
      if(str[i] == "*"){
	st.push(val[0] * val[1]);
      }
      if(str[i] == "/"){
	st.push(val[1] / val[0]);
      }
    }
    else{
      st.push(atoi(str[i].c_str()));
    }
  }
  return st.top();
}

int main(){

  int n = 1;
  string s;
  getline(cin,s);
  n = atoi(s.c_str());

  for(int i = 0; i < n; i++){
    string str;
    getline(cin,str);
    str = str.substr(0,str.size()-1);
    // vector<string> vec = toReversePorland(str);
    // for(int i = 0; i < vec.size(); i++)
    //   cout << vec[i] << endl;
    cout << calc(toReversePorland(str)) << endl;
  }
  
  return 0;
}

Compiler output:
a.cc:149:2: warning: null character(s) ignored
  149 | }<U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000>
      |  ^~~~~~~~
a.cc:149:4: error: stray '\35' in program
  149 | }<U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000>
      |                  ^~~~~~~~
a.cc:149:5: warning: null character(s) ignored
  149 | }<U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000>
      |                          ^~~~~~~~
a.cc:149:8: error: stray '\35' in program
  149 | }<U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000>
      |                                                  ^~~~~~~~
a.cc:149:9: warning: null character(s) ignored
  149 | }<U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000>
      |                                                          ^~~~~~~~
a.cc:149:12: error: stray '\35' in program
  149 | }<U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000>
      |                                                                                  ^~~~~~~~
a.cc:149:13: warning: null character(s) ignored
  149 | }<U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000>
      |                                                                                          ^~~~~~~~
a.cc:149:16: error: stray '\35' in program
  149 | }<U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+001D><U+0000><U+0000><U+0000><U+00