#C2168. Partition Sum of Alphanumeric Strings

    ID: 45454 Type: Default 1000ms 256MiB

Partition Sum of Alphanumeric Strings

Partition Sum of Alphanumeric Strings

You are given a list of alphanumeric strings. For each string, compute the sum after converting every character to a number. The conversion follows these rules:

( \text{if } c \text{ is a digit} \quad \rightarrow \quad \text{value} = c - '0' )

( \text{if } c \text{ is a lowercase letter} \quad \rightarrow \quad \text{value} = c - 'a' + 10 )

For example, the character 'a' will be converted to 10 and 'z' will be 35. The sum for the string is the sum of the converted values of all its characters.

Your task is to process an input containing several such strings and output the corresponding sums for each string in the same order.

inputFormat

The first line of the input contains a single integer ( n ) (( 1 \le n \le 10^5 )) representing the number of strings. Each of the following ( n ) lines contains a non-empty alphanumeric string consisting of digits (0-9) and lowercase letters (a-z).

outputFormat

Output ( n ) integers separated by a single space. The ( i^{th} ) integer represents the sum obtained by converting each character of the ( i^{th} ) string according to the given rules.## sample

3
ab12
1a2b
a12345
24 24 25