白駿5622号(ダイヤル)


質問する



ろんり


この問題は本当に簡単です.一言で言えば
適当な文字列に数字を合わせると、すぐに解けます.
if文で文字列に適当な数字をつければいいです.

正解


string = input()
cnt = 0
for i in range(0,len(string)):
    if string[i] == 'A' or  string[i] == 'B' or  string[i] == 'C':
        cnt += 3
    elif string[i] == 'D' or  string[i] == 'E' or  string[i] == 'F':
        cnt += 4
    elif string[i] == 'G' or  string[i] == 'H' or  string[i] == 'I':
        cnt += 5
    elif string[i] == 'J' or  string[i] == 'K' or  string[i] == 'L':
        cnt += 6
    elif string[i] == 'M' or  string[i] == 'N' or  string[i] == 'O':
        cnt += 7
    elif string[i] == 'P' or  string[i] == 'Q' or  string[i] == 'R' or string[i] == 'S':
        cnt += 8
    elif string[i] == 'T' or  string[i] == 'U' or  string[i] == 'V':
        cnt += 9
    elif string[i] == 'W' or  string[i] == 'X' or  string[i] == 'Y' or string[i] == 'Z':
        cnt += 10
print(cnt)