Hello everyone!
I am having trouble with some code. I am getting “Runtime Error” whenever I run the out-commented code in this for-loop, and I can’t figure out why.
I think it has something to do with how scanf reads strings, but I can’t figure out why.
Could you possibly provide a hint as to why?
It doesn’t matter which string I try it on.
Thanks!
int main()
{
int test_cases;
string input;
scanf("%d", &test_cases);
for (int i = 0; i < test_cases; i++)
{
cin >> input;
//scanf("%s", &input);
cout << onp(input) << endl;
//printf("%s\n", onp(input));
}
return 0;
}