alp = ['ABC','EDF','GHI','JKL','MNO','PQRS','TUV','WXYZ']
A = input()
sec = 0
for i in range (len(A)):
for j in alp: #abc ~ wxyz ๊น์ง ๋๋ฆฌ๊ธฐ
if A[i] in j: # a[i] ๋ ์ ์ ์ฐพ๊ธฐ
sec += alp.index(j) + 3 #ํด๋น ์ธ๋ฑ์ค ๊ฐ์ + 3์ ํด์ฃผ๋ฉด ๋๋ค.
print(sec)
๊ท์น !
1๋ฒ -> 2์ด
2๋ฒ (index = 0 ) => 3์ด
3๋ฒ (index = 1) => 4์ด
9๋ฒ (index = 7) => 10์ด
+ 3์ ๊ท์น์ด ์๋ค. ์ด ์ ์ ์ฌ์ฉํด์ ์ฝ๋ฉํ ๊ฒ
๐ฌ index() : ํด๋น ์์๊ฐ ์ฒ์์ผ๋ก ๋ฑ์ฅํ๋ ์์น์ ์ธ๋ฑ์ค๋ฅผ ๋ฐํ
<< ๐คฎ ๋งํ ์ด์ & ํด๊ฒฐ >>
A = input()
sec = 0 #1๋ฒ = 2์ด
print (A)
for i in range(len(A)): #W0 #A2
print(A[i])
if 'A'or'B'or'C' == A[i]:
sec += 3
elif 'D'or'E'or'F' == A[i]:
sec += 4
elif 'G'or'H'or'I' == A[i]:
sec += 5
elif 'J'or'K'or'L' == A[i]:
sec += 6
elif 'M'or'I'or'N' or 'O' == A[i]:
sec += 7
elif 'P'or'Q'or'R' or 'S' == A[i]:
sec += 8
elif 'T'or'U'or'V' == A[i]:
sec += 9
elif 'W'or'X'or'Y' or 'Z' == A[i]:
sec += 10
else:
sec += 11
print(sec)
๋ฌธ์ ํ๋ํ๋ ๋น๊ตํด์ ์ด๋ฅผ ๋ํด์ฃผ๋ ค๊ณ ํ๋๋ฐ ์ด์ํ๊ฒ ๋น๊ต๊ฐ ์๋๋ค ใ ใ
์๊พธ 3์์ ๊ฑธ๋ฆผ.. ๊ทธ๋์ ์คํจํด์ ์๋ก์ด ์ฝ๋๋ฅผ ์ฐพ์๋ดค๋ค.