#C2552. File Extension Counter and Organizer
File Extension Counter and Organizer
File Extension Counter and Organizer
You are given a list of filenames, each containing an extension (e.g. file.txt). Your task is to count the number of files for each extension, treating extensions in a case-insensitive manner, and then output the result in a sorted order (alphabetically by the extension).
The output should list each distinct extension (in lowercase) followed by the number of files with that extension, separated by a single space on each line. Use (\text{lowercase}) conversion for all extensions, and sort the extensions in increasing lexicographical order.
inputFormat
The first line contains an integer (n) representing the number of filenames. The following (n) lines each contain a single filename. Each filename contains at least one dot ('.') which separates the name from its extension.
outputFormat
Print the counts of each file extension in ascending alphabetical order. Each line must contain the extension in lowercase, a space, and then the count.## sample
5
report.docx
data.csv
SCRIPT.JS
image.PNG
photo.jpg
csv 1
docx 1
jpg 1
js 1
png 1
</p>