์ƒˆ์†Œ์‹

๐Ÿงฎ PS

๋ฐฑ์ค€ (boj) 10808 ํŒŒ์ด์ฌ - ์•ŒํŒŒ๋ฒณ ๊ฐœ์ˆ˜

  • -

๋ฌธ์ œ ๋งํฌ : https://www.acmicpc.net/problem/10808

 

10808๋ฒˆ: ์•ŒํŒŒ๋ฒณ ๊ฐœ์ˆ˜

๋‹จ์–ด์— ํฌํ•จ๋˜์–ด ์žˆ๋Š” a์˜ ๊ฐœ์ˆ˜, b์˜ ๊ฐœ์ˆ˜, …, z์˜ ๊ฐœ์ˆ˜๋ฅผ ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„ํ•ด์„œ ์ถœ๋ ฅํ•œ๋‹ค.

www.acmicpc.net

 

์•ŒํŒŒ๋ฒณ์„ ์นด์šดํŒ…ํ•˜์—ฌ ์ถœ๋ ฅํ•ด์•ผํ•œ๋‹ค. ๋”ฐ๋ผ์„œ ๋จผ์ € 0์œผ๋กœ๋œ ๋ฐฐ์—ด์„ ๋งŒ๋“ค์–ด ์ค€๋‹ค. (๋ณ€์ˆ˜ answer)

๋‹ค์Œ answer์˜ ์ž๋ฆฟ๊ฐ’(์ธ๋ฑ์Šค)๋ฅผ ์•Œ๊ธฐ ์œ„ํ•ด ์•ŒํŒŒ๋ฒณ์ˆœ์„œ์— ๋งž๋Š” ๋ฌธ์ž์—ด์„ ๋งŒ๋“ ๋‹ค.

๊ทธ๋ฆฌ๊ณ  for๋ฌธ์„ ์ด์šฉํ•˜์—ฌ ์ž…๋ ฅ๋˜๋Š” input ๋ฌธ์ž๋ฅผ ํ•˜๋‚˜์”ฉ ์ž๋ฆฟ๊ฐ’์— ๋งž๊ฒŒ +1ํ•ด์ค€๋‹ค.

 

 

alph = 'abcdefghijklmnopqrstuvwxyz'
answer = [0 for _ in range(26)]
s = input()
for i in s:
    idx = alph.find(i)
    answer[idx] +=1
answer=[str(k) for k in answer]
print(" ".join(answer))

 

Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.