https://www.acmicpc.net/problem/2866 import sysinput = sys.stdin.readlineR, C = map(int, input().split(" "))li = list()for _ in range(R): li.append(input().strip())yul = list()# 열을 기준으로 새로운 리스트 생성for i in range(C): new_S = '' for j in range(R): new_S = new_S + li[j][i] yul.append(new_S)length = Cdap = 0# 각 열에서 첫줄에 해당하는 글자를 지우고 # Set에 저장해서 중복 문자열 제거# 개수 세서 처음과 같으면 중단, 아니면 count..
https://www.acmicpc.net/problem/12904 - 시간 초과 (BFS 정순)import sysfrom collections import dequeinput = sys.stdin.readlinedef checkStr(xx): dq = deque() dq.append(xx) check = 0 while dq: now = dq.popleft() # 단어가 같으면 1 리턴 if now == T: return 1 # 길이가 더 길어지면 now 건너뛰기 elif len(now) > max_in: continue # 두가지 경우 모두 해서 dq에 ..
https://www.acmicpc.net/problem/1339 import sysinput = sys.stdin.readlineN = int(input())words = list()alphabet = dict()for _ in range(N): word = input().strip() words.append(word) # 각 알파벳의 점수? 자리값 구하기 for i in range(len(word)): alphabet[word[i]] = alphabet.get(word[i], 0) + 10**(len(word)-i-1)# 자리 값을 기준으로 정렬s_li = sorted(alphabet.items(), key=lambda x:x[1], reverse=True)max_s..