์•ŒํŒŒ๋ฒณ์ฐพ๊ธฐ 2

๋ฐฑ์ค€ 1152) ๋‹จ์–ด์˜๊ฐœ์ˆ˜ [Python]

์™œ ํ‹€๋ ธ๋Š”์ง€ ์ •๋ง ๋ชจ๋ฅด๊ฒ ๋Š” . .  ๋ฌธ์ œ์˜€๋‹ค. Python ์„ ์ฃผ ์–ธ์–ด๋กœ ํ•˜๊ณ  ์žˆ์ง€๋งŒ, ๋‚˜๋Š” ์—ญ์‹œ ์ œ๋Œ€๋กœ ์•Œ๊ณ  ์žˆ๋Š”๊ฒŒ ์•„๋‹Œ๊ฐ€๋ณด๋‹ค. ์ฒซ๋ฒˆ์งธ ์‹œ๋„.  print(len(input().split(' ')))  ๋‘๋ฒˆ์งธ ์‹œ๋„. string = list(input().split(' '))if '' in string: string.remove('')print(len(string))  ์„ธ๋ฒˆ์งธ ์‹œ๋„. string_list = map(str,input().split(' '))string_list=list(string_list)for string in string_list: if string == '' or string == ' ': # print("this is blank : ",string) ..

Develop/Algorithm 2024.09.04

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

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 2024.08.24