#K56877. Minimum Distinct Characters
Minimum Distinct Characters
Minimum Distinct Characters
In this problem, you are given a string of lowercase English letters and you can perform an arbitrary number of operations on it. The goal is to minimize the number of distinct characters in the string. It can be shown that no matter the initial composition, the string can always be transformed such that only one distinct character remains. More formally, given a string (s) of length (n), the optimal solution satisfies (\min, \text{distinct characters} = 1).
inputFormat
The input consists of two lines. The first line contains an integer (n) representing the length of the string. The second line contains a string (s) of length (n) composed of lowercase English letters.
outputFormat
Output a single integer representing the minimum number of distinct characters obtainable after applying the allowed operations.## sample
1
a
1