string = input()
check = [-1]*26
for i in range(len(string)):
if check[ord(string[i])-97] == -1:
check[ord(string[i])-97] = i
for i in range(26):
print(check[i], end=' ')
์์คํค์ฝ๋๋ฅผ ํ์ฉํด ๊ฐ๋จํ๊ฒ ํ ์ ์๋ค.
๋ฌธ์๋ฅผ ์์คํค์ฝ๋๋ก ๋ณํํด์ฃผ๋ ๋ด์ฅ ๋ฉ์๋์ด๋ค.
https://docs.python.org/3/library/functions.html#ord
'Develop > Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๋ฐฑ์ค 1018) ์ฒด์คํ ๋ค์ ์น ํ๊ธฐ[Python] (0) | 2024.10.14 |
---|---|
๋ฐฑ์ค 1152) ๋จ์ด์๊ฐ์ [Python] (0) | 2024.09.04 |