'Add' up the letters in a word My dad is a retired teacher, and he used to give combined spelling and math quizzes, where the student would spell a word, and then 'score' the word by adding up the letters, where a=1, b=2, etc. (e.g. cat = 3+1+20=24).  This made grading the quizzes easier, as he would just have to check for incorrect 'scores' rather than incorrectly spelled words, and had the added benefit of testing 2 skills at once.

He hired a friend of mine to write a program that would score words for him, so he could generate lengthy answer keys without error.  This problem is inspired by that program.

Requirements:


Accept any word with uppercase and lowercase letters
Return an error for any special characters, i.e. spaces, hyphens, @^%# etc.
a=1, b=2,... and A=1, B=2,...
Print the score of the word
(Optional) check that the word is in a dictionary after scoring, and print a warning if it is not.
No importing an external letter->number dictionary.  You must generate it yourself.


Any language is acceptable. This is similar to the 'digital root battle,' but much simpler.
Ruby, 43 characters

$_=gets.upcase;p~/[^A-Z]/?_: $_.sum-64*~/$/


The error message this generates isn't exactly helpful, though.
Both solutions posted here assume the input has no trailing linebreak, so to test them, use echo -n.

Ruby, 76 characters with dictionary check

l=STDIN.gets;$_=l.upcase;p~/[^A-Z]/?_: $_.sum-64*~/$/;[*$&lt;].index(l)||$&gt;&lt;&lt;?W


The warning message consists of the single character "W". The path to the dictionary has to be supplied via ARGV. Example usage:

$ echo -n asd | ruby addletters.rb /usr/share/dict/words
24
W
$ echo -n cat | ruby addletters.rb /usr/share/dict/words
24