#K53362. Minimum Operations to Beautiful String
Minimum Operations to Beautiful String
Minimum Operations to Beautiful String
You are given a string s of length n. In one operation, you can change any character of s to the character a
. A string is considered beautiful if all its characters are a
. Your task is to determine the minimum number of operations required to transform the given string into a beautiful string.
For each test case, count the number of characters in the string that are not a
. This count represents the minimum number of operations required.
Note: Although the integer n representing the length of the string is provided, it is not strictly necessary since you can obtain the length directly from the string.
inputFormat
The input is given via standard input. The first line contains a single integer T
, the number of test cases. Each test case consists of two lines:
- The first line contains an integer
n
representing the length of the string. - The second line contains the string
s
.
outputFormat
For each test case, output a single integer on a new line that indicates the minimum number of operations needed to transform the string into a beautiful string.
## sample3
5
abcde
3
aaa
4
xyza
4
0
3
</p>