Alphabet Position Sum
EasyP3Coding
For the lowercase string s, map a to 1, b to 2, and so on up to z to 26. Return the sum of the values of all characters of s.
Example 1
- Input
- s = "aba"
- Output
- 4
Example 2
- Input
- s = "abc"
- Output
- 6
Example 3
- Input
- s = "z"
- Output
- 26
Constraints
- 0 <= s.length <= 10^5
- s consists of lowercase letters.
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 10. ⌘Enter runs, ⌘⇧Enter submits.