pager
imagine a pager with only one button for the letter "A" you press the button one time for "B"ou press it two times for "E" you press it five times ,for "G" its pressed seven times
explanation :
for example if the given strings abcde , then
the total number of times the button pressed 1+2+4+5
so the output is 12
input: abde
output: 12
intput:xyz
output:75
inp = list(input())
alphabet = list('abcdefghijklmnopqrstuvwxyz')
out = 0
for i in range(len(inp)):
for j in range(26):
if inp[i] == alphabet[j]:
out += j + 1
print(out)
Comments
Leave a comment