#C13651. Reverse Strings with Last Occurrence

    ID: 43213 Type: Default 1000ms 256MiB

Reverse Strings with Last Occurrence

Reverse Strings with Last Occurrence

Given a list of strings, your task is to create a dictionary in which each key is a string from the list and its corresponding value is the reversed string. In case of duplicate strings, only the last occurrence should be used in the dictionary.

The output dictionary must have its keys sorted in lexicographical order. For example, if the input list contains both occurrences of apple, the value stored will be that of the last appearance of apple.

Consider the reversal operation is defined as: \(\text{reverse}(s) = s[::-1]\) in Python.

inputFormat

The input is given via standard input (stdin). The first line contains an integer \(n\), which indicates the number of strings. Following this, there are \(n\) lines, each containing a single string.

outputFormat

Print a dictionary (or map) as a string in the following format:

{"key1": "reversed_value1", "key2": "reversed_value2", ...}

The keys should be in lexicographical order.

## sample
4
apple
banana
cherry
date
{"apple": "elppa", "banana": "ananab", "cherry": "yrrehc", "date": "etad"}