I am getting a WA if I use raw_input(). If I use raw_input.strip(),answer gets submitted!!
Why are we using raw_input.strip() here? plzz help!
Thanks in advance!
link to question
I am getting a WA if I use raw_input(). If I use raw_input.strip(),answer gets submitted!!
Why are we using raw_input.strip() here? plzz help!
Thanks in advance!
link to question
This happens because the problem setter may have accidentally printed an extra space at the end. Something like printf("%d "). This does not cause errors in C/C++ but Python’s raw_input takes in the full line as input and assumes space is part of the input.
My suggestion is always use raw_input().strip() as you there is a chance an extra space might accidentally get printed while making the test cases.