3
void helper(string s, unordered_set<string> &dict, int start, int index, string current,5
if (start == s.size()) {6
ans.push_back(current);9
if (index == s.size()) return;11
string sub = s.substr(start, index - start + 1);13
if (dict.count(sub) > 0) {15
if (current.size() == 0)18
recursion = current + " " + sub;19
helper(s, dict, index + 1, index + 1, recursion, ans);21
helper(s, dict, start, index + 1, current, ans);24
vector<string> wordBreak(string s, vector<string> &wordDict) {25
unordered_set<string> dict;26
for (int i = 0; i < wordDict.size(); i++) {27
dict.insert(wordDict[i]);30
helper(s, dict, 0, 0, "", ans);