Replace all double space into single space and loop till you can find double space at least once.