SOLUTION INFO
C++ · main.cpp
class Solution {
public:
int minimumLength(string s) {
vector<int> cnt(26);
for(const char &ch: s) ++ cnt[ch - 'a'];
int answer = 0;
for(int i = 0; i < 26; ++i) {
if(cnt[i] <= 2) answer += cnt[i];
else answer += cnt[i] % 2 ? 1 : 2;
}
return answer;
}
};
SOLUTION DESCRIPTION
풀이 설명
등록된 풀이 설명이 없습니다.