Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void allsubstrings(string str,int st_index,int end_index, vector<string>& strvector)
- {
- string st1,st2;
- vector<string> tempvector;
- vector<string>::iterator it;
- if(st_index == end_index)
- {
- st1.push_back(str[st_index]);
- strvector.push_back(st1);
- }
- else
- {
- allsubstrings(str,st_index+1,end_index,strvector);
- for(it = strvector.begin(); it != strvector.end(); ++it)
- {
- st2 = *it;
- st2 += str[st_index];
- tempvector.push_back(st2);
- st2.clear();
- }
- st1.push_back(str[st_index]);
- tempvector.push_back(st1);
- strvector.insert( strvector.end(), tempvector.begin(), tempvector.end() );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement