#C169. License Usage Analyzer
License Usage Analyzer
License Usage Analyzer
You are given a project containing several files. Each file is associated with a third‐party software license. Your task is to count how many files are issued under each license type.
More formally, given an integer \(n\) representing the number of files and then \(n\) lines each containing two strings: the file name and its license type, you need to output a JSON object where each key is a license type and its corresponding value is the number of files that use that license.
The answer should be computed case-sensitively, meaning that different cases of letters in license types are considered distinct (e.g. MIT
and mit
are different).
inputFormat
The input is given from stdin with the following format:
- The first line contains an integer \(n\), the number of files.
- Each of the following \(n\) lines contains two strings separated by whitespace: the file name and the license type.
outputFormat
Output to stdout a JSON object (dictionary) without extra spaces. The keys are the license types and the values are the counts of files for that license.
## sample5
file1.py MIT
file2.js GPL
file3.java MIT
file4.cpp Apache
file5.rb GPL
{"MIT":2,"GPL":2,"Apache":1}