Alphabet Score

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 128M

Author:
Problem type
Allowed languages
Python

qwertytown4life is getting bullied for using Python 3. Help cheer him up by creating a program that tells him the alphabet score of a word.

A word's alphabet score is the occurrence of each letter times the place that letter is in the alphabet. For example, the string ab gives 3 because there is one a, and it is the first letter in the alphabet. So a's alphabet score 1 \times 1 = 1. Next, there is one b, and because b is the second letter in the alphabet, b's alphabet score is 1 \times 2 = 2. Therefore the string's alphabet score is 1 + 2 = 3.

Also, you must code it in Python 3.

Input Specification

You will receive one line of input containing a non-empty string S. It will only contain lowercase letters.

1 \le |S| \le 8 \times 10^6

Output Specification

Output the alphabet score of the string.

Constraints

Subtask 1 [60%]

1 \le |S| \le 10^6

Subtask 2 [40%]

No additional constraints.

Sample Input 1

python

Sample Output 1

98

Sample Input 2

qwertytown

Sample Output 2

180

Comments


  • -3
    chaimaeou2000  commented on July 27, 2020, 5:47 p.m. edited

    my code works on my idle but here they give a WA


    • 2
      Kirito  commented on July 27, 2020, 11:05 p.m.

      Don't prompt for input.


  • -9
    BULLET999  commented on May 28, 2020, 3:37 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -12
    kdrkdr  commented on May 7, 2020, 12:35 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -1
    Orion222  commented on May 5, 2020, 9:50 p.m.

    why is there a memory error