#C9036. Minimum Book Groups
Minimum Book Groups
Minimum Book Groups
You are given a list of book titles. Your task is to determine the minimum number of groups required so that no two books in the same group start with the same letter. In other words, you need to group the book titles in such a way that each group contains books with distinct starting letters.
For example, if the list of book titles is ["apple", "banana", "carrot", "apricot", "berry", "cherry"], there are three distinct starting letters: a, b, and c, so the answer is 3.
inputFormat
The input begins with an integer n representing the number of books. The following n lines each contain a single book title.
outputFormat
Output a single integer denoting the minimum number of groups required such that no two titles in the same group start with the same letter.## sample
6
apple
banana
carrot
apricot
berry
cherry
3
</p>