std::vector<std::string> split(std::string str, char delim = ' ') {
std::vector<std::string> result;
size_t start = 0;
while (start < str.length()) {
size_t pos = str.find(delim, start);
if (pos == std::string::npos) pos = str.length();
result.push_back(str.substr(start, pos - start));
start = pos + 1;
}
return result;
}