我的目标是遍历字符串数据库并在每次出现每个子字符串时获取计数。换句话说,我需要从字符串中提取所有可能的单词组合。
例如,输入可能是"this is the first string".
我想提取"this is", "is the", "the first", "first string", "this is the", "is the first", "the first string", "this is the first", "is the first string".
我只需要从左到右,总是按顺序。
我不确定从哪里开始。我已经有了读取数据库并保存到列表中的代码,只需要知道如何根据空格字符提取所有可能的子字符串。
