#C2786. Transform to Unique Character String
Transform to Unique Character String
Transform to Unique Character String
Alex is challenged to transform a given string S into a string comprised of one unique character by performing exactly K operations. In one operation, any character in the string may be changed to any other character.
The task is to determine if it is possible to achieve such a transformation. The transformation is considered successful if, after the operations, all characters in the string are identical.
Note: It is allowed to perform extra operations as long as the total number does not exceed K operations.
inputFormat
The first line of input contains an integer T, the number of test cases. For each test case, the first line contains the string S and the second line contains the integer K.
outputFormat
For each test case, output a single line containing "YES" if it is possible to transform the string into one with all characters identical using at most K operations, otherwise output "NO".## sample
3
abc
2
aabb
1
xyz
3
YES
NO
YES
</p>