Ad
  • Custom User Avatar
  • Custom User Avatar

    I noticed most of the solutions provided here do not account for having multiple spaces inside the string. They do trim() the spaces at the right- and lefthand side of the string, but if the string reads ' Houston, we have a problem', they count it -incorrectly- as 7 words, because of the 2 extra spaces between 'a problem'.

    I know this isn't stated explicitly in the description, but I feel accepted solutions should take this into account. Or?

    [edit: haha, multiple spaces between words are removed by this online editor, but I think you get the point ;-)]