#P1038A. Equality
Equality
No submission language available for this problem.
Description
You are given a string of length , which consists only of the first letters of the Latin alphabet. All letters in string are uppercase.
A subsequence of string is a string that can be derived from by deleting some of its symbols without changing the order of the remaining symbols. For example, "ADE" and "BD" are subsequences of "ABCDE", but "DEA" is not.
A subsequence of called good if the number of occurences of each of the first letters of the alphabet is the same.
Find the length of the longest good subsequence of .
The first line of the input contains integers () and ().
The second line of the input contains the string of length . String only contains uppercase letters from 'A' to the -th letter of Latin alphabet.
Print the only integer — the length of the longest good subsequence of string .
Input
The first line of the input contains integers () and ().
The second line of the input contains the string of length . String only contains uppercase letters from 'A' to the -th letter of Latin alphabet.
Output
Print the only integer — the length of the longest good subsequence of string .
Samples
Note
In the first example, "ACBCAB" ("ACAABCCAB") is one of the subsequences that has the same frequency of 'A', 'B' and 'C'. Subsequence "CAB" also has the same frequency of these letters, but doesn't have the maximum possible length.
In the second example, none of the subsequences can have 'D', hence the answer is .