I was solving a problem in CF. So, I came up with an idea(don't know if it would work for sure)..I implemented the code. While I was testing the sample input..it successfully passed! But when I submit the problem, the sample didn't passed. Then I tested it in the CF custom testing but it showed me the same result that the sample test cases failed! But my editor showed me that all samples passed. So, I tested it on codechef editor & online c++ compiler. They showed me my test cases passed! Don't understand what happened! Is there any issue on CF compiler or testing?
Problem link: 701C - Они повсюду
My Code -> (https://ideone.com/8H7sXX)
The input - 7 bcAAcbc
The real output - 3
The output showed me — 2
Look into how to run your code with address sanitizer enabled (or using valgrind). It'll show where you go out of bounds on an array and cause undefined behavior.
https://mirror.codeforces.com/blog/entry/15547