#K41747. Reverse Alphabetical Encoding
Reverse Alphabetical Encoding
Reverse Alphabetical Encoding
You are given a message consisting of lowercase letters. Each letter is assigned a value according to its reverse position in the alphabetical order. Specifically, a is worth 26, b is worth 25, …, and z is worth 1. The task is to calculate the sum of the encoded values of the message.
You need to process multiple test cases provided via standard input. For each test case, you will be given a message string (which may be empty), and you must output the resulting sum on a separate line.
For example:
Input: 2 hello abc</p>Output: 83 75
The encoding rule is given in latex format as follows:
For each character \( c \) in the message, its value is computed as \( 27 - (\text{ord}(c)-\text{ord}('a')+1) \).
inputFormat
The first line of input contains an integer \( T \) representing the number of test cases.
Each of the following \( T \) lines contains a single string, the message to be encoded. The message consists of lowercase letters (or may be empty).
Input is read from standard input (stdin).
outputFormat
For each test case, print an integer on a new line representing the sum of the encoded values of the message.
Output is printed to standard output (stdout).
## sample2
hello
abc
83
75
</p>