#41. 映射键值修改与格式化输出

映射键值修改与格式化输出

Map Modification

Background

Congcong works at a restaurant and is responsible for managing the food and topping lists on the menu. He needs to update the topping list according to specific rules to ensure the menu's accuracy.

Problem Description

Given a map of food keys and topping values, modify and return the map as follows:

  1. If the key "potato" has a value, set that as the value for the key "fries".
  2. If the key "salad" has a value, set that as the value for the key "spinach".

Input Format

Input consists of a series of key-value pairs representing the initial food topping map. Each key-value pair is in the format "key": "value", and multiple key-value pairs may be separated by spaces.

"key1": "value1" "key2": "value2" ...

Output Format

Output the modified map as a JSON-formatted string.

`{"key1": "value1\