Ad
  • Default User Avatar

    excelent solution, but recursion in this case can lead to RecursionError: maximum recursion depth exceeded in comparison in very rare cases.

  • Default User Avatar

    I propose add test cases with 3 spaces, and 4, 5 spaces between words. Almost all solutions do not save 3 spaces between words.

  • Default User Avatar

    Becuase it test case present not bool values. Try this code sum([True, None]) and you will get TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'