#39. 字典/地图基本修改操作
字典/地图基本修改操作
Modify Food Map
Background
Congcong is organizing his recipes. He has a map (or dictionary) that records various foods and their toppings, and now he needs to make some standard modifications to this map.
Problem Description
Given a map of food keys and topping values, modify and return the map as follows:
- If the key "ice cream" is present, set its value to "cherry".
- In all cases, set the key "bread" to have the value "butter".
Input Format
Input is given from standard input in the following format.
A map (or dictionary) representing food key-value pairs. The specific format depends on the programming language, typically a string representation of key-value pairs.
Output Format
Output is printed to standard output in the following format.
The modified map (or dictionary), represented in standard JSON format or an equivalent key-value pair string.
Sample
"ice cream": "peanuts"
{"bread": "butter\