#39. 字典/地图基本修改操作

    ID: 39 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatMap-1gesp1条件结构

字典/地图基本修改操作

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:

  1. If the key "ice cream" is present, set its value to "cherry".
  2. 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\