코딩테스트/프로그래머스 - LV 0
[프로그래머스] 문자열 잘라서 정렬하기
웅드
2024. 2. 1. 18:59
- 풀이
#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;
}
반응형