O(n log(n)) algorithm to separate concatenated words with spaces based on a dictionary