Highest Scoring Word

User
Posted by anthonyo
1 year ago in Q/A Section
110 views
2 replies
User
anthonyo
Posted 1 year ago

Given a string of words, you need to find the highest scoring word.

Each letter of a word scores points according to its position in the alphabet: `a = 1, b = 2, c = 3` etc.

For example, the score of `abad` is `8` (1 + 2 + 1 + 4).

You need to return the highest scoring word as a string.

If two words score the same, return the word that appears earliest in the original string.

All letters will be lowercase and all inputs will be valid.

Image preview

Replies (1)

Please login to post a reply.

Thread Actions
Related Tags