#C2112. Maximum Distinct Characters after Replacements

    ID: 45393 Type: Default 1000ms 256MiB

Maximum Distinct Characters after Replacements

Maximum Distinct Characters after Replacements

Given a string s and an integer k representing the maximum number of replacement operations allowed, determine the maximum number of distinct characters that can be obtained. In each replacement operation, you can change any character to another character that is not already in the string. Note that since there are only 26 lowercase English letters, the answer cannot exceed 26.

You should compute the answer using the formula:

$$ \text{result} = \min(26, |\text{distinct}(s)| + k) $$

where \(|\text{distinct}(s)|\) is the number of distinct characters in the string s.

inputFormat

The input consists of two lines:

  1. The first line contains an integer k which is the maximum number of replacement operations allowed.
  2. The second line contains the string s.

outputFormat

Output a single integer, which is the maximum number of distinct characters possible after at most k replacement operations.

## sample
2
abcabc
5