#C2046. Enhanced Number Value
Enhanced Number Value
Enhanced Number Value
You are given a special number system where each digit is immediately followed by a symbol that enhances its value. The enhancement for each digit is determined by the following rules:
- \(\%\) increases the digit value by \(1\)
- \(@\) increases the digit value by \(2\)
- \(#\) increases the digit value by \(3\)
- \(!\) increases the digit value by \(4\)
For a given input string that consists of alternating digits and symbols, your task is to compute the sum of all enhanced digits. For example, for the input string "3@5#8!", the calculation is shown as:
\(3+2 + 5+3 + 8+4 = 25\)
inputFormat
The input consists of a single line from standard input. The line contains a string of even length made up of alternating digits (0-9) and one of the symbols: %, @, #, or !.
outputFormat
Output a single integer to standard output representing the sum of all enhanced digits.## sample
3@5#8!
25