a weighs 26, b weighs 25, …, z weighs 1. A word scores as follows: multiply each letter's weight by its position in the word (counting from 1) and add up all the products.
Given a string word, return its score.word='yes' → 70
Backward-alphabet weights: y = 2, e = 22, s = 8. Total: 1·2 + 2·22 + 3·8 = 2 + 44 + 24 = 70.
word='za' → 53
1·1 + 2·26 = 53.
word.length ≤ 1000word consists of lowercase English letters onlyword='yes'
70
Run checks the first 3 tests in your browser. Submit checks all 57 tests on the server, hidden ones included.