Apple interview question

remove spaces in a string