Start by counting frequencies with a hash map. That part is straightforward. The question is how to extract the top k without sorting all entries.
Use a min-heap of size k. The min-heap keeps the "worst" candidate on top, so when a better candidate arrives, you can pop the worst and push the new one. The comparison is: lower frequency is worse. For tied frequencies, later alphabetical order is worse (since you want alphabetically earlier words to rank higher).
After scanning every word, the heap contains exactly k entries. Pop them all into a list. Since a min-heap gives you the smallest first, reverse the list to get highest-frequency-first order.