The alphabets A...Z are mapped integers 65…90 (ASCII value of A...Z is 65...90) and a...z are mapped to 97…122(ASCII value of a…z is 97...122). The Beautiful function is a function that takes a character as an input and outputs an integer. The integer The Beautiful function returns is the biggest integer in the ASCII representation of the input character.
For example,
If 'A' is the input to the function, the function would return 6 because ASCII of A is 65 and 6 is the biggest among 6 and 5.
If 'C' is the input to the function, the function would return 7 because ASCII of C is 67 and 7 is the biggest among 6 and 7.
If 'x' is the input to the function, the function would return 2 because ASCII of x is 120 and 2 is the biggest among 1, 2 and 0.
Given a string as input, your task is to find out sum of all the values returned by The Beautiful Function.
** The input string may contain numeric values. In that case just add the numeric value. **
Input:
The first line of input will have number of test cases T. T < 10,000
Next T lines will have a string of length L. L < 1,000.
Output:
T lines, each line containing one integer.
Sample Input:
4
abcd
12
a12345b
azAZ09
Sample Output:
28
3
33
35
Explanation for the last test case:
a -> 9
z -> 2
A -> 6
Z -> 9
0 -> 0
9 -> 9
9 + 2 + 6 + 9 + 0 + 9 = 35
For example,
If 'A' is the input to the function, the function would return 6 because ASCII of A is 65 and 6 is the biggest among 6 and 5.
If 'C' is the input to the function, the function would return 7 because ASCII of C is 67 and 7 is the biggest among 6 and 7.
If 'x' is the input to the function, the function would return 2 because ASCII of x is 120 and 2 is the biggest among 1, 2 and 0.
Given a string as input, your task is to find out sum of all the values returned by The Beautiful Function.
** The input string may contain numeric values. In that case just add the numeric value. **
Input:
The first line of input will have number of test cases T. T < 10,000
Next T lines will have a string of length L. L < 1,000.
Output:
T lines, each line containing one integer.
Sample Input:
4
abcd
12
a12345b
azAZ09
Sample Output:
28
3
33
35
Explanation for the last test case:
a -> 9
z -> 2
A -> 6
Z -> 9
0 -> 0
9 -> 9
9 + 2 + 6 + 9 + 0 + 9 = 35