Algorithm/BaekJoon (10) 썸네일형 리스트형 [백준 1157] 단어 공부 python 문제 풀이 풀이 소스코드 1 아스키코드를 이용하여 알파벳 순서에 맞는 인덱스에 알파벳의 개수를 카운팅 # 단어 공부 word = input().upper() cnt = [0] * 26 # 문자별 카운팅할 배열을 생성 for s in word: # 카운팅 cnt[ord(s)-65] += 1 max_idx = 0 # max값 인덱스 찾기 for i, c in zip(range(26),cnt): if c > cnt[max_idx]: max_idx = i # 출력하기 if cnt.count(cnt[max_idx]) > 1: print('?') else: print(chr(max_idx+65)) 다른 풀이 리스트 인덱스 이용 words = input().upper() unique_words = list(set(w.. [백준 2577] 숫자의 개수 python 문제 입력 150 266 427 출력 3 1 0 2 0 0 0 2 0 0 나의 풀이 인덱스별로 count를 해서 숫자의 개수를 저장함 소스 코드 a = int(input()) b = int(input()) c = int(input()) sum = list(map(int,list(str(a * b * c)))) arr = [0] * 10 for i in sum: arr[i] += 1 for a in arr: print(a) 다른 풀이 리스트 count 매서드 이용 A=int(input()) B=int(input()) C=int(input()) result = list(str(A*B*C)) for i in range(10): print(result.count(str(i))) 이전 1 2 다음