C++ アルゴリズムとデータ構造のライブラリ
#include "library/string/split.hpp"$O(\vert S \vert)$
vector<string> list = split(S, ",");
#pragma once
vector<string> split(const string &S, const char &sep) {
vector<string> res = {""};
for (auto &&v : S) {
if (v == sep) {
res.emplace_back("");
} else {
res.back() += v;
}
}
return res;
}#line 2 "library/string/split.hpp"
vector<string> split(const string &S, const char &sep) {
vector<string> res = {""};
for (auto &&v : S) {
if (v == sep) {
res.emplace_back("");
} else {
res.back() += v;
}
}
return res;
}