Map Sum Pairs
Implement the MapSum class: 1. MapSum() Initializes the MapSum object. 2. void insert(String key, int val) Inserts the key-val pair into the map. If the key already existed, the original key-value pair will be overridden to the new one. 3. int sum(string prefix) Returns the sum of all the pairs' value whose key starts with the prefix.
1. 1 <= key.length, prefix.length <= 50 2. key and prefix consist of only lowercase English letters. 3. 1 <= val <= 1000
Input is managed for you
Output is managed for you
apple 3 ap app 2 apple 2 ap exit