Well, all you could have known beforehand is that split() without arguments is more tolerant with respect to whitespace.
That several spoj problems do have mal formatted input is something you learn during problem solving. Often the comments on the problem page give hints.
Unfortunately python is a bit more 'vulnerable' here compated to other common languages, so a lot of users will not even observe any issue.
Most of the spoj problems have worked for me just with the use of split(). Sometimes when handling string input, ".strip() comes in handy, too. And only for very bad input I once used an even more robust approach, posted it here some time ago 