remove unnecessary spaces in text