Please help me with following problem of transforming expression of spoj here is the link. It is giving runtime error.
#include <iostream>
#include <stack>
#include <string>
using namespace std;
int main()
{
int testcases;
cin >> testcases;
while(testcases-->0)
{
string s;
cin >> s;
cout << s;
stack<string> st;
for(int i=0;i<s.length();i++)
{
if(s.at(i)=='(')
continue;
else
if(s.at(i)==')')
{
string s2=st.top();
st.pop();
string expression=st.top();
st.pop();
string s1=st.top();
st.pop();
string tba=s1+s2+expression+"";
st.push(tba);
cout << tba << endl ;
}
else
st.push(s.at(i)+"");
}
string ss=st.top();
cout << ss;
}
}
And the error coming is not understandable. following is the error with input in first and second line.
1
(a+(b*c))
(a+(b*c))do relocation protocol version %d.
o relocation protocol version %d.
uery failed for %d bytes at address %p
udo relocation protocol version %d.
do relocation protocol version %d.
o relocation protocol version %d.
uery failed for %d bytes at address %pery failed for %d bytes at address %p
udo relocation protocol version %d.
do relocation protocol version %d.
o relocation protocol version %d.
uery failed for %d bytes at address %pery failed for %d bytes at address %p