백준 34553번: 알파벳 점수 계산기 #Python

ColorlessDia·2025년 11월 17일

algorithm/baekjoon

목록 보기
729/818
S = input()

total_score = 1
cumulative_score = 1

for i in range(1, len(S)):
    before = S[i - 1]
    current = S[i]

    if before < current:
        cumulative_score += 1
    else:
        cumulative_score = 1
    
    total_score += cumulative_score

print(total_score)

0개의 댓글