I have been solving this problem https://codeforces.com/contest/339/submission/129086329 but while on test case 7(a very long test case) , I get this error saying 'the solution is executed with error out of bounds or other memory error' on line 18'. Codeforces is new for me, so could you tell me what is wrong with my code and how should I fix it? It would mean a lot.
Thanks
You have never assigned value to A so its length equals to zero. That's why you have out of bounds error,
I did initialize A, in line10. Please elaborate..or if you could write the exact line of code required then it would be easier for me to understand. Thanks
Add this line: A.resize(s.length()); before accessing your variable A.
Thanks a lot @UpAndDown. My problem is fixed now :)
Though I don't want to bother you anymore but if you could tell me why this only happened with bigger test cases and what topic should I learn so that this doesn't happen again.
Thanks again !
Learn what's index out of bounds exception, don't forget to assign any value to a variable anymore. If you want to assign a default value to it ("" — for strings, 0 — for ints and so on) do this explicitly.
OK, updated the comment above.