Develop/Algorithm

๋ฐฑ์ค€ 10890) ์•ŒํŒŒ๋ฒณ ์ฐพ๊ธฐ [Python]

proggg 2024. 8. 24. 13:08

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