Low orbitParsing, validationOpened 2 Dec, 00:00
Day 2: Gift Tag Checksums
The parcel bay is drowning in gift tags, and most of them were printed by a faulty machine. Each line of your input is one tag: some capital letters, a dash, and a number, such as TREE-91.
A tag's checksum is worked out from its letters: give each letter its place in the alphabet (A = 1 … Z = 26), multiply it by its position in the tag (the first letter is position 1), and add the results. A tag is genuine if its checksum equals its number. For TREE the checksum is 1×20 + 2×18 + 3×5 + 4×5 = 91, so TREE-91 is genuine.
For example:
SNOW-148 TREE-91 BELL-69 HOLLY-247 GIFT-132 FEAST-195 SLED-47
The genuine tags are TREE-91, HOLLY-247 and FEAST-195. Adding their numbers gives 533.
What is the sum of the numbers on the genuine tags?