AmazonOA #104
Calculate Max Salary
估计困难可在线判题
The pay for A through E is 1, 10, 100, 1000 and 10000 respectively. If a higher level appears later than a given day, that day's pay is subtracted; otherwise it is added. Change at most one character and find the maximum pay.
输入格式
One line with a string containing only ABCDE. The original gives no value ranges; this site sets the length to 1..100000.
输出格式
Output a single integer answer.
样例 1
输入:
ABCDEEDCBA
输出:
31000
样例 2
输入:
A
输出:
10000
样例 3
输入:
EE
输出:
20000
样例说明
Example 1: change D on the fourth day to E, which reduces the negative values in the earlier part and adds 10000, for an optimum of 31000. Example 2: change A directly to E for a pay of 10000. Example 3: everything is already E, for a total pay of 20000.