๋ชฉ๋ก์ „์ฒด ๊ธ€ (181)

๐ŸŒฑ → ๐ŸŒณ

[๋ฐฑ์ค€] 10809๋ฒˆ: ์•ŒํŒŒ๋ฒณ ์ฐพ๊ธฐ

https://www.acmicpc.net/problem/10809 10809๋ฒˆ: ์•ŒํŒŒ๋ฒณ ์ฐพ๊ธฐ ๊ฐ๊ฐ์˜ ์•ŒํŒŒ๋ฒณ์— ๋Œ€ํ•ด์„œ, a๊ฐ€ ์ฒ˜์Œ ๋“ฑ์žฅํ•˜๋Š” ์œ„์น˜, b๊ฐ€ ์ฒ˜์Œ ๋“ฑ์žฅํ•˜๋Š” ์œ„์น˜, ... z๊ฐ€ ์ฒ˜์Œ ๋“ฑ์žฅํ•˜๋Š” ์œ„์น˜๋ฅผ ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„ํ•ด์„œ ์ถœ๋ ฅํ•œ๋‹ค. ๋งŒ์•ฝ, ์–ด๋–ค ์•ŒํŒŒ๋ฒณ์ด ๋‹จ์–ด์— ํฌํ•จ๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค๋ฉด -1์„ ์ถœ www.acmicpc.net ์ •๋‹ต ์ฝ”๋“œ: s = input() alphabet = list(range(97,123)) # a=97, z=122 ์•„์Šคํ‚ค์ฝ”๋“œ ์ˆซ์ž ๋ฒ”์œ„ for i in alphabet: print(s.find(chr(i))) ๊ตฌํ˜„ ์ƒ๊ฐํ•  ๋•Œ ์ „์ฒด ์•ŒํŒŒ๋ฒณ์„ list๋กœ ๋ถˆ๋Ÿฌ์™€์•ผํ•œ๋‹ค๋Š” ๊ฑด ์•Œ์•˜์ง€๋งŒ ์•„์Šคํ‚ค์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์ƒ๊ฐํ•˜์ง€ ๋ชปํ•ด์„œ ์• ๋ฅผ ๋จน์—ˆ๋‹ค ๐Ÿ“Œ find ํ•จ์ˆ˜ ์–ด๋–ค ์ฐพ๋Š” ๋ฌธ์ž๊ฐ€ ๋ฌธ์ž์—ด ์•ˆ์—์„œ ์ฒซ..

Algorithms 2022. 7. 12. 08:51