Hello.
I submitted this code to this problem with option "GNU C++ 4.6" and received "WA on test 1".
Output was:
1
CS
while the expected answer:
2
SC
However, the program was correct in my pc (I use Dev-C++). I tried to resubmit the same code but with other option "MS C++" and it worked.
So, can somebody explain to me why this code didn't worked with "GNU C++ 4.6"?
You just have array index out of bounds in the line 32. G++ gives from1[-1] different than MSVC for this specific occasion. Max works incorrectly (because you are comparing with quasi-random value).
Study to debug your programs yourself. Or use Java as I do... ;-)
Thank you for your work. It is clear now.