백준 20959번: Šifra #Python

ColorlessDia·2024년 4월 30일

algorithm/baekjoon

목록 보기
161/807
ciphertext = input()

integer_set = set()

temp = ''

for i, char in enumerate(ciphertext):
    if char.isdigit():
        temp += char
    elif char.isalpha() and len(temp) != 0:
        integer_set.add(temp)
        temp = ''
    elif char.isalpha():
        temp = ''

    if i == len(ciphertext) - 1 and len(temp) != 0:
        integer_set.add(temp)

print(len(integer_set))

0개의 댓글