void split(const string &str, vector<string> &res, const char pattern)
{
istringstream is(str);
string temp;
while (getline(is, temp, pattern))
{
if (temp.length() != 0)
{
res.push_back(temp);
}
}
return;
}
void trim(std::string &s)
{
if (s.empty())
return;
s.erase(0, s.find_first_not_of(" "));
s.erase(s.find_last_not_of(" ") + 1);
}