I was solving the problem of Adding Reverse Numbers in nogoctuan_contests but when I submit I get an error named “Wrong Problem!”. I don’t know why it is happening.
If by any chance it is due to my code(which, most probably, is not the reason here), do have a look on my code:
//Problem from SPOJ contest
// Adding reverse numbers
#include <iostream>
#include <string>
#include <stack>
#include <algorithm>
#include <sstream>
using namespace std;
string removezeroes(string str) {
int i = 0;
while(str[i] == '0') {
i++;
}
str.erase(0, i);
return str;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//my code
stack <int> s;
long a;
ostringstream strval;
string x, y;
long m, n, val;
cin >> a;
while (a--) {
cin >> x >> y;
reverse(x.begin(), x.end());
reverse(y.begin(), y.end());
m = stoi(x);
n = stoi(y);
val = m + n;
//string stri = boost::lexical_cast<string>(val);
strval << val;
string newstr = strval.str();
reverse(newstr.begin(), newstr.end());
cout << removezeroes(newstr) << "\n";
strval.str("");
strval.clear();
}
return 0;
}```