- Published on
[백준 10808] 알파벳 개수
- Authors
- Name
- 심성헌 (SeongHeon Sim)
문제
알파벳 소문자로만 이루어진 단어 S가 주어진다. 각 알파벳이 단어에 몇 개가 포함되어 있는지 구하는 프로그램을 작성하시오.
풀이
#include <bits/stdc++.h>
using namespace std;
string s;
int result['z' + 1];
int main() {
cin >> s;
for (char c: s) {
result[c]++;
}
for (int i = 'a'; i <= 'z'; i++) {
cout << result[i] << " ";
}
return 0;
}