#C8790. Nested File Structure

    ID: 52811 Type: Default 1000ms 256MiB

Nested File Structure

Nested File Structure

You are given a list of Unix-style file paths. Your task is to construct a hierarchical nested dictionary (i.e. a JSON object) that represents the file system. For example, the file path home/user/file1.txt should be represented as \{\text{home}: \{\text{user}: \{\text{file1.txt}: \{\}\}\}\}.

If the list is empty, return an empty dictionary {}. Handle multiple file paths appropriately, merging common directory parts.

inputFormat

The input is read from standard input (stdin). The first line contains an integer n — the number of file paths. Each of the following n lines contains a file path in Unix format (directories separated by '/').

outputFormat

Print to standard output (stdout) the nested dictionary in JSON format that represents the directory structure. An empty list of file paths should result in output {}.

## sample
1
home/user/file1.txt
{"home":{"user":{"file1.txt":{}}}}