Shopping Cart Price
Statement
Goal
You must output the total cost of the items in a shopping cart.Input
Line 1 :An integer charCount for the number of items in the cart.
Line 2 :A string of characters stringCart with each character representing an item in a shopping cart.
Line 3 :A character and a number, itemPrice representing the item type and price. Each character is separated by a space.
Line 2 :A string of characters stringCart with each character representing an item in a shopping cart.
Line 3 :A character and a number, itemPrice representing the item type and price. Each character is separated by a space.
Output
A number representing the total cost of all items in the cart.
Constraints
0 < charCount < 20
stringCart lowercase letters a-z
0 < Prices < 32
stringCart lowercase letters a-z
0 < Prices < 32
Example
Input
3 abc a 1 b 2 c 3
Output
6
Game modes
Shortest
Test cases
Test 1 Test
Input
3
abc
a 1 b 2 c 3
Output
6
Validator 1 Validator
Input
3
def
d 2 e 3 f 4
Output
9
Test 2 Test
Input
2
aa
a 5
Output
10
Validator 2 Validator
Input
3
bbb
b 4
Output
12
Test 3 Test
Input
10
adbdcbcdcd
a 4 b 2 c 1 d 9
Output
47
Validator 3 Validator
Input
10
dcdcbcdbda
a 5 b 2 c 1 d 9
Output
48
Test 4 Test
Input
19
qwertyuiopasdfghjkl
q 10 w 1 e 1 r 1 t 1 y 1 u 1 i 1 o 1 p 1 a 1 s 1 d 1 f 1 g 1 h 1 j 1 k 1 l 1
Output
28
Validator 4 Validator
Input
19
abcdefghijklmnopqrs
a 20 b 1 c 1 d 1 e 1 f 1 g 1 h 1 i 1 j 1 k 1 l 1 m 1 n 1 o 1 p 1 q 1 r 1 s 1
Output
38
Solution language
Solution
Stub generator input