#36. 映射键值修改
映射键值修改
Map Modification
Background
Dawei is organizing his collection, and he has a special habit. Whenever he finds a particular item (represented by key 'a'), he always gives it to his friend Xiaoxiao (represented by key 'b'), and he no longer keeps the item himself. He hopes you can help him automate this organizing process.
Problem Description
Modify and return the given map as follows: if the key "a" has a value, set the key "b" to have that value, and set the key "a" to have the value "". Basically "b" is a bully, taking the value and replacing it with the empty string.
Input Format
The input consists of a series of key-value pairs, where each pair is composed of a string key and a string value, separated by spaces. Both keys and values are enclosed in double quotes.
"key1": "value1" "key2": "value2" ...
Output Format
Output a JSON formatted string representing the modified map. Key-value pairs are separated by commas, and the entire map is enclosed in curly braces.
{"key1": "value1\