본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 4613번 Quicksum

by 현장 2022. 9. 18.

-Code

while 1:
    s = input()
    if s == '#':
        break
    res = 0
    for i in range(len(s)):
        if s[i] == ' ':
            continue
        res += (i + 1) * (ord(s[i]) - ord('A') + 1)
    print(res)