웅재의 코딩세상
[프로그래머스] 문자열 잘라서 정렬하기 본문
- 풀이
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;
vector<string> solution(string myString) {
vector<string> answer;
stringstream ss(myString);
string s;
while(getline(ss,s,'x')){
if(!s.empty()) answer.push_back(s);
}
sort(answer.begin(), answer.end());
return answer;
}
반응형
'코딩테스트 > 프로그래머스 - LV 0' 카테고리의 다른 글
[프로그래머스] 빈 배열에 추가, 삭제하기 (0) | 2024.02.01 |
---|---|
[프로그래머스] 1로 만들기 (0) | 2024.02.01 |
[프로그래머스] 왼쪽 오른쪽 (0) | 2024.02.01 |
[프로그래머스] 배열 조각하기 (0) | 2024.02.01 |
[프로그래머스] 2의 영역 (0) | 2024.02.01 |