#C906. Binary String Transformation under Budget
Binary String Transformation under Budget
Binary String Transformation under Budget
You are given two binary strings: an initial string and a target string, both of length \(n\). The transformation cost is defined as the number of positions where the two strings differ, mathematically expressed as \(\text{cost} = \sum_{i=1}^{n} \mathbb{1}_{\{initial_i \neq target_i\}}\). You are also provided with a budget \(b\). Your task is to determine whether the initial string can be transformed into the target string within the given budget. If \(\text{cost} \le b\), output "YES"; otherwise, output "NO".
Input/Output Format: The input is read from standard input (stdin) and output should be printed to standard output (stdout).
inputFormat
The input is given from standard input in the following format:
n b initial target
where:
n
is an integer representing the length of the strings,b
is an integer representing the budget,initial
is the initial binary string of lengthn
,target
is the target binary string of lengthn
.
outputFormat
The output, printed to standard output, is a single line containing either "YES" if the transformation can be done within the budget or "NO" if it cannot.
## sample5 3
11000
10011
YES