0
\$\begingroup\$

This question already has an answer here:

It has been said, or copied from http://ifunny.co/fun/SiQ7PlRR3 rather, that if...

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

equals...

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 

then...

 K +  N +  O +  W +  L + E + D + G + E
11 + 14 + 15 + 23 + 12 + 5 + 4 + 7 + 5 = 96%

H + A +  R + D +  W +  O +  R + K
8 + 1 + 18 + 4 + 23 + 15 + 18 + 11 = 98%

Both are important, but fall just short of 100%, but...

A +  T +  T + I +  T +  U + D + E
1 + 20 + 20 + 9 + 20 + 21 + 4 + 5 = 100%

The program will take as its input a string containing only letters and will output the sum of the alphabet values as listed above.

Test cases

LAZINESS
==> 105

NEGATIVITY
==> 132

PROCRASTINATION
==> 192

SELLING YOUR SOUL TO SATAN
==> 314

This is code golf, so the shortest program in bytes wins.

\$\endgroup\$

marked as duplicate by AdmBorkBork, SuperJedi224, Arcturus, Community Dec 1 '15 at 16:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    \$\begingroup\$ Is this code-golf or what ? \$\endgroup\$ – Paul R Dec 1 '15 at 16:12
  • 1
    \$\begingroup\$ Why is it a percentage? Isn't the end result just the sum of the values? \$\endgroup\$ – Brian Dec 1 '15 at 16:19
  • 1
    \$\begingroup\$ Definitely dup of Finding the Value of Words!. Thank you for sharing! \$\endgroup\$ – A. Burnheimer Dec 1 '15 at 16:22