프로그래머스 181869 공백으로 구분하기 1

1 개요[ | ]

프로그래머스 181869 공백으로 구분하기 1

2 C++[ | ]

#include <string>
#include <vector>
#include <regex>

using namespace std;

vector<string> solution(string my_string) {
    regex rx(" ");
    sregex_token_iterator iter(my_string.begin(), my_string.end(), rx, -1), end;
    return {iter, end};
}
#include <string>
#include <vector>
#include <sstream>

using namespace std;

vector<string> solution(string my_string) {
    vector<string> answer;
    istringstream ss(my_string);
    for (string s; getline(ss, s, ' '); ) {
        answer.push_back(s);
    }
    return answer;
}
#include <string>
#include <vector>
#include <sstream>

using namespace std;

vector<string> solution(string my_string) {
    vector<string> answer;
    istringstream ss(my_string);
    string s;
    while(ss >> s) {
        answer.push_back(s);
    }
    return answer;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}