#P10566. Minimum Transformation Time to Uppercase
Minimum Transformation Time to Uppercase
Minimum Transformation Time to Uppercase
You are given a string that contains uppercase letters, lowercase letters, and digits. You can change any character to any other character. The cost to change a character with ASCII value \( a \) to another character with ASCII value \( b \) is \( |a - b| \) time units.
Your task is to convert the entire string so that it contains only uppercase letters, while minimizing the total transformation time.
inputFormat
The input consists of a single line containing a non-empty string \( S \) that contains digits and letters only. The length of \( S \) is between 1 and 1000.
outputFormat
Output a single integer representing the minimum total time required to transform the string so that all its characters are uppercase.
sample
ABC
0