728x90
출처
https://www.acmicpc.net/problem/1159
내 풀이
더보기
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N;
vector<int> player(26, 0);
string result = "";
int main()
{
cin >> N;
for (int i = 0; i < N; i++)
{
string name;
cin >> name;
player[name[0] - 'a']++;
if(player[name[0]-'a'] == 5)
{
result += name[0];
}
}
sort(result.begin(), result.end());
if (result.empty()) cout << "PREDAJA";
else cout << result;
}
느낀점
스무스..