Sum of Missing Characters

Time limit1sMemory limit128 MB

Summary
For each string, sum the ASCII values of uppercase letters that never appear in it.
Level

Easy1 of 10

Topics
String, Hash map, Implementation
Solved
No attempts yet

Problem

Given a string S consisting only of uppercase English letters, compute the sum of the ASCII values of the uppercase letters that do not appear in S.

For example, if S is ABCDEFGHIJKLMNOPQRSTUVW, the letters that do not appear are X, Y, and Z. Their ASCII values are 88, 89, and 90, so the required sum is 267.

The ASCII values of the uppercase letters are as follows.

LetterABCDEFGHIJKLMNOPQRSTUVWXYZ
ASCII6566676869707172737475767778798081828384858687888990

Input

The input consists of T test data sets. The first line contains an integer T, the number of test data sets. Each test data set consists of one line containing a string S. S contains only uppercase English letters and has length at most 1000.

Output

For each test data set, print on its own line the sum of the ASCII values of the uppercase letters that do not appear in S.

Examples1

  1. Example 1

    Input
    2
    ABCDEFGHIJKLMNOPQRSTUVW
    A
    
    Expected output
    267
    1950