티스토리 뷰

https://www.acmicpc.net/problem/10808

 

 

 

 

python

S = input()
SS = [0 for i in range(26)]

for i in range(len(S)):
    SS[ord(S[i])-97]+=1
print(str(SS).replace(',', '')[1:-1])

 

c

#include <stdio.h>
#include <string.h>

int main(){

	char str[100] = " ";
	int alpha[26] = {0, }, i, j, Length = 0;

	scanf("%s", str);
	Length = strlen(str);

	for(i = 0; i < Length; i++)
		alpha[str[i] - 97]++;

	for(j = 0; j < 26; j++)
		printf("%d ", alpha[j]);
}