// splits a std::string into vector<string> at a delimiter
vector<string> split(string x, char delim = ' ')
{
x += delim; //includes a delimiter at the end so last word is also read
vector<string> splitted;
string temp = "";
for (int i = 0; i < x.length(); i++)
{
if (x[i] == delim)
{
splitted.push_back(temp); //store words in "splitted" vector
temp = "";
i++;
}
temp += x[i];
}
return splitted;
}