#48. 字符串首尾字符映射

字符串首尾字符映射

First and Last Character Map

Background

Congcong, while studying data structures, encountered a problem involving string processing. He needs to extract specific information from a set of strings and organize it into a map structure.

Problem Description

Given an array of non-empty strings, create and return a Map<String, String> as follows: for each string add its first character as a key with its last character as the value.

Input Format

Input is given from standard input in the following format.

Multiple non-empty strings, separated by spaces.

Output Format

Output is printed to standard output in the following format.

A JSON string representing the Map<String, String>, where the order of key-value pairs is not fixed.

Sample

"code" "bug"
{"b": "g\