program_contest_library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub ferin-15/program_contest_library

:heavy_check_mark: string/string_split.cpp

Back to top page

Verified with

Code

// BEGIN CUT
// sepで区切る
vector<string> split(const string &str, char sep) {
    vector<string> v;
    auto first = str.begin();
    while( first != str.end() ) {
        auto last = first;
        while( last != str.end() && *last != sep ) ++last;
        v.push_back(std::string(first, last));
        if( last != str.end() ) ++last;
        first = last;
    }
    return v;
}
// END CUT

#line 1 "string/string_split.cpp"
// BEGIN CUT
// sepで区切る
vector<string> split(const string &str, char sep) {
    vector<string> v;
    auto first = str.begin();
    while( first != str.end() ) {
        auto last = first;
        while( last != str.end() && *last != sep ) ++last;
        v.push_back(std::string(first, last));
        if( last != str.end() ) ++last;
        first = last;
    }
    return v;
}
// END CUT

Back to top page