atcoder#ARC140A. [ARC140A] Right String
[ARC140A] Right String
Score : points
Problem Statement
For a string consisting of lowercase English letters, consider the question below, and let be the answer.
$$T$$You are given a string $S$ of length $N$ consisting of lowercase English letters. You can perform the operation below at most $K$ times (possibly zero). $$
- Choose a character of and change it to any lowercase English letter.
Find the minimum possible value of after your operations.
Constraints
- is a string of length consisting of lowercase English letters.
- and are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
4 1
abac
2
If you change the fourth character c
to b
in the first operation, you get abab
, with .
cannot be made or less in one or fewer operations, so the answer is .
10 0
aaaaaaaaaa
1
6 1
abcaba
3