lstrip and rstrip can behave poorly.

Thanks for the find, @danielfrg!