백준 문제풀이

백준 10808번 - C++

diligent_gideok 2022. 4. 30. 06:10
#include <bits/stdc++.h>
using namespace std;


int main(void) {
	ios::sync_with_stdio(0);
	cin.tie(0);

	int freq[26] = {};
	string s;
	cin >> s;
	for (auto c : s)
		freq[c - 'a']++;
	for (int i = 0; i < 26; i++)
		cout << freq[i] << ' ';

}

/*
// s를 25번 확인한다.

int main(void) {
	ios::sync_with_stdio(0);
	cin.tie(0);

	string s;
	cin >> s;
	for (char a = 'a'; a <= 'z'; a++) {
		int cnt = 0;
		for (auto c : s)
			if (a == c) cnt++;
		cout << cnt << ' ';
	}
}
*/

'백준 문제풀이' 카테고리의 다른 글

백준 13300번 - C++  (0) 2022.04.30
백준 11328번 - C++  (0) 2022.04.30
백준 10807번 - C++  (0) 2022.04.30
백준 2577번 - C++  (0) 2022.04.30
백준 1919번 - C++  (0) 2022.04.30