#C3255. Calculate Total Character Weight

    ID: 46662 Type: Default 1000ms 256MiB

Calculate Total Character Weight

Calculate Total Character Weight

Given T test cases, each containing a string consisting of alphabets and digits, calculate the total weight of each string. The weight of an alphabet letter is defined as its position in the English alphabet regardless of its case (i.e., both 'a' and 'A' have a weight of 1, 'b' and 'B' have a weight of 2, etc.). Each digit contributes its numerical value to the total weight.

The formula for the weight of a letter is given by:

[ \text{weight}(c) = \text{ord}(\text{lower}(c)) - \text{ord}('a') + 1, ]

For example, for input "aB2" the total weight is calculated as:

[ 1 ; (for; 'a') + 2 ; (for; 'B') + 2 ; (for; '2') = 5, ]

Your task is to read the input from standard input (stdin) and write the result for each test case to standard output (stdout), one result per line.

inputFormat

The first line contains an integer T representing the number of test cases. Each of the following T lines contains a single string.

Example:

3
hello
World123

outputFormat

For each test case, output a single integer on a new line representing the total weight of the given string.

Example:

52
? (computed value here)
...
## sample
3
a
B
9
1

2 9

</p>