백준 11478번: 서로 다른 부분 문자열의 개수 #Python

ColorlessDia·2024년 9월 2일

algorithm/baekjoon

목록 보기
288/836
S = input()

substring_dict = dict()

count = 0

for i in range(1, len(S) + 1):
    
    for j in range(len(S) + 1 - i):
        
        if S[j:j + i] not in substring_dict:
            substring_dict[S[j:j + i]] = 1
            count += 1

print(count)

0개의 댓글