You are given an in-memory map (dictionary) from strings to strings.
Implement two functions:
string serialize(map<string, string> m)
map<string, string> deserialize(string data)
Requirements:
serialize(m)
must always reconstruct the original map exactly.
:
,
,
,
;
,
|
,
=
). You may assume they do not contain the null character
"\0"
.
Specify and implement:
serialize
produces that format for a given map.
deserialize
parses that format back into the original map and handles edge cases (e.g., empty map, empty keys/values, special characters).