design map allow followingmap stre key give valuereturn sum value key prefix equal give stringimplement MapSum classmapsum Initializes MapSum objectvoid insertstre key int val Inserts keyval pair map if key existed original keyvalue pair overridden new oneint sumstre prefix return sum pair value key start prefix Example 1inputmapsum insert sum insert sum apple 3 ap app 2 apoutputnull null 3 null 5explanationmapsum mapsum new mapsummapsuminsertapple 3 mapsumsumap return 3 apple 3mapsuminsertapp 2 mapsumsumap return 5 apple app 3 2 5 constraints1 keylength prefixlength 50key prefix consist lowercase English letters1 val 1000At 50 call insert sum