#include #include std::vector split(std::string target, std::string pattern) { std::vector res; size_t start = 0, next = 0; while ((next = target.find(pattern, start)) != std::string::npos) { res.push_back(target.substr(start, next - start)); start = next + pattern.length(); } res.push_back(target.substr(start)); return res; }