#C5261. Maximum Beauty of a Substring
Maximum Beauty of a Substring
Maximum Beauty of a Substring
Given a string s
of length n
, your task is to determine the maximum beauty among all possible substrings of s
. The beauty of a substring is defined as the number of distinct characters it contains. Formally, for a substring S, its beauty is given by:
$$ B(S) = \left| \{ c : c \text{ appears in } S \} \right| $$
Print the maximum beauty value that can be achieved by any substring of s
.
inputFormat
The first line contains an integer n
— the length of the string.
The second line contains a string s
consisting of n
lowercase English letters.
outputFormat
Output a single integer — the maximum beauty among all substrings of s
.
7
abcabc
3
</p>