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.

Subtasks

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


  • -2
    yeebruh21  commented on Aug. 11, 2020, 9:43 p.m.

    if (cpp > python) { return true; } else { return false; }


  • 0
    notpeachay420  commented on Aug. 6, 2020, 10:31 p.m.

    why does it say that no judge is available for the problem


  • -2
    chaimaeou2000  commented on July 27, 2020, 1:47 p.m. edited

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


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

      Don't prompt for input.


  • -6
    BULLET999  commented on May 27, 2020, 11:37 p.m.

    This comment is hidden due to too much negative feedback. Click here to view it.


  • -5
    kdrkdr  commented on May 6, 2020, 8:35 p.m.

    This comment is hidden due to too much negative feedback. Click here to view it.


  • 0
    Orion222  commented on May 5, 2020, 5:50 p.m.

    why is there a memory error