#include <iostream> // std::cout
#include <string> // std::string
#include <vector>
using namespace std;
void SplitString(const string&source, vector<string>&vec, const string& sepreator)
{
string::size_type posStart = 0;
string::size_type pos = 0;
pos = source.find(sepreator,posStart);
while(pos != string::npos){
vec.push_back(source.substr(posStart,pos - posStart));
posStart = pos + sepreator.size();
pos = source.find(sepreator,posStart);
}
if (posStart != source.length()){
vec.push_back(source.substr(posStart));
}
}
int main ()
{
string s = "aa__bbb__c__ddd";
vector<string> vec;
string sep = "__";
SplitString(s,vec,sep);
return 0;
}