Added a method to add spaces between elements in a string