Notice, first and last is [first, last].
The following references will help you understand how to use functions in std::map.
The input consists of a series of commands. A command can be an insert or range erase.
insert: inserts a string (cmd) with the key (key) to map. If the key has already existed, insert the cmd at the begining of string (the string which the key belongs).
For example,
insert 0 "abc"
insert 1 "def"
the map should contain "abc", "def".
insert 0 "xyz"
the map should contain "xyzabc", "def".
range erase: erase the strings from key (first) to key (last).
operator<<: outputs all strings in map. From the smallest key to biggest key. Output a space character (' ') after printing an element.
Complete insert, erase and operator<<.