Question 1
Given a list of filenames (with extensions), one per line, count the number of files for each extension. Output format: count .ext, sorted by descending count, then by descending extension for ties.
Instructions
- Write your script in script.sh.
- Read from standard input, write to standard output.
- Extensions are case-insensitive; output in lowercase.
- Count column is right-aligned to 2 characters.
Sample Input
hello.txt
bye.pdf
cats.txt
video.mp4
music.mp3
document.docx
list.txt
song.mp3
movie.MP4
Sample Output
3 .txt
2 .mp4
2 .mp3
1 .pdf
1 .docx
Constraints
- Filenames always contain an extension.
- Extensions may be in any case; output must be lowercase.
- Output must be in lowercase.