https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AXVJuEvqLAADFASe
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
map을 이용하여 자동으로 정렬하도록 해주었다.
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main() {
int T;
cin >> T;
for (int tc = 1; tc <= T; tc++) {
map<char, int> m;
string str;
vector<char> v;
cin >> str;
for (auto& c : str)
m[c]++;
for (auto& e : m) {
if (e.second % 2 != 0)
v.push_back(e.first);
}
string answer(v.begin(), v.end());
if (answer == "") answer = "Good";
cout << "#" << tc << " " << answer << endl;
}
return 0;
}
'코딩 > SWEA' 카테고리의 다른 글
[SWEA] 2477. [모의 SW 역량테스트] 차량 정비소 C++ (0) | 2024.10.10 |
---|---|
[SWEA] 1824. 혁진이의 프로그램 검증 C++ (1) | 2024.10.09 |
[SWEA] 1486. 장훈이의 높은 선반 C++ (1) | 2024.10.09 |
[SWEA] D3. 7732. 시간 개념 C++ (0) | 2024.09.01 |