#P10566. 「Daily OI Round 4」Analysis
「Daily OI Round 4」Analysis
Problem Description
Xiao C's IT teacher assigned Xiao C some homework, as follows:
There is a string containing uppercase letters, lowercase letters, and digits. You may change any character into another character. Suppose the ASCII code of the character before the change is , and after the change is . Then this change costs units of time. You need to turn the entire string into a string that contains only uppercase letters.
Xiao C also has many other important assignments such as Chinese, math, and English. To save time, you need to calculate the minimum time Xiao C needs to make the string contain only uppercase letters.
Input Format
One line containing a string , which is the string given by the teacher.
Output Format
One line containing a non-negative integer , representing the minimum total time needed to make the string contain only uppercase letters.
AA0aa
31
3kyOu
89
Hint
Sample Explanation
For the first sample, the best way is to change it into . Then the cost is . It is easy to prove that there is no better solution.
Here, is the ASCII code of character , is the ASCII code of character , is the ASCII code of character , and is the ASCII code of character .
Constraints
This problem uses bundled testdata.
Let be the length of string .
| Score | ||
|---|---|---|
For all testdata, it is guaranteed that , and contains only uppercase letters, lowercase letters, and digits.
Translated by ChatGPT 5