Let's say a directory is inputted by user.  

How do I sort and count all files based on their name's first letter? I suppose there has to be a comparator for sorting but I got no idea what to do with counting.