#42. 条件删除映射键值对

    ID: 42 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatMap-1gesp3字符串条件结构

条件删除映射键值对

Conditional Key-Value Pair Removal

Background

In data processing, it is sometimes necessary to modify data structures based on specific conditions. For example, when certain data items exist simultaneously and satisfy a particular relationship, they may need to be removed together to maintain data consistency or meet business logic.

Problem Description

Modify and return the given map as follows: if the keys "a" and "b" are both in the map and have equal values, remove them both.

Input Format

The input consists of a single line string representing a map. The string is composed of several key-value pairs, each in the format "<key>": "<value>", separated by spaces. Both keys and values are strings.

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

Output Format

The output is a single line string representing the modified map. The format is a JSON-style collection of key-value pairs, e.g., `{"key1": "value1\