백준 - (# 10808)

Eon·2020년 10월 25일
0

Algorithm

목록 보기
37/70

https://www.acmicpc.net/problem/10808
알파벳 소문자로만 이루어진 단어 S가 주어진다. 각 알파벳이 단어에 몇 개가 포함되어 있는지 구하는 프로그램을 작성하시오.

Code

word = input()
alphabets = [0] * 26
for s in word :
    alphabets[(ord(s)-97)%26] += 1

print(' '.join(str(x) for x in alphabets))

참고

  • 아스키코드 변환
    ord(문자) 문자 -> 10진수
    chr(10진수) 10진수 -> 문자
profile
👨🏻‍💻 🏃🏻‍♂️ 🎶

0개의 댓글