1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include <iostream> #include <sstream> #include <algorithm> #include <vector> using namespace std; int main() { int cnt; cin >> cnt; stringstream output; while (cnt--) { vector<string> s; string str; cin >> str; for ( int i = 0; i < str.length(); i += 2) { string str2 = str.substr(i, 2); s.push_back(str2); } sort(s.begin(), s.end()); for (auto ss : s) { output << ss; } output << endl; } cout << output.str(); return 0; } |
'C++ > 알고리즘' 카테고리의 다른 글
[마이다스챌린지2017예선] 트럼프카드 문제 (TrumpCard) (0) | 2017.05.14 |
---|---|
[마이다스챌린지2017예선] 소수합 문제 (0) | 2017.05.13 |
[마이다스챌린지2017예선] 마이다스수(소수구하기) (0) | 2017.05.13 |
[마이다스챌린지2017예선] 세일이벤트 문제 (0) | 2017.05.13 |
[알고스팟] stl map의 key 찾는 법과, loop 참고용 (0) | 2017.05.13 |