본문 바로가기

BOJ

[백준] 10808번 알파벳 개수 C++

#include <bits/stdc++.h>
using namespace std;

int main(void) {
	string str;
	cin >> str;
	int arr[26] = { 0, };

	for (int i = 0; i < str.size(); i++) {
		arr[str[i] - 'a']+=1;
	}

	for (int n : arr)
		cout << n << " ";
}

'BOJ' 카테고리의 다른 글

[백준] 13300 방 배정 c++  (0) 2020.04.20
[백준] 10807번 개수 세기 c++  (0) 2020.04.20
[백준] 2309번 일곱 난쟁이 c++  (0) 2020.04.20
[백준] 10804번 카드 역배치 c++  (0) 2020.04.19
[백준] 1267번 핸드폰요금 c++  (0) 2020.04.19