remove duplicate chars, consecutive spaces from a string