vector<string> split(const string& s, char del) {
vector<string> tokens;
stringstream ss(s);
string item;
while (getline(ss, item, del)) {
tokens.push_back(item);
}
return tokens;
}
#include <bits/stdc++.h>
using namespace std;
vector<string> split(const string &s, char delim) {
vector<string> res;
stringstream ss(s);
string token;
while (getline(ss, token, delim)) {
res.push_back(token);
}
return res;
}
int main() {
string s = "apple,banana,cherry";
vector<string> words = split(s, ',');
for (auto &w : words) cout << w << "\\n";
}