Split string into words

后端 未结 4 1109
予麋鹿
予麋鹿 2021-02-03 13:27

I am looking for the most efficient algorithm to form all possible combinations of words from a string. For example:

Input String: forevercarrot

Output:

foreve         


        
4条回答
  •  -上瘾入骨i
    2021-02-03 14:12

    See this question which has even better answers. It's a standard dynamic programming problem:

    How to split a string into words. Ex: "stringintowords" -> "String Into Words"?

提交回复
热议问题