#C11822. DNA Sequence Acceptance

    ID: 41181 Type: Default 1000ms 256MiB

DNA Sequence Acceptance

DNA Sequence Acceptance

In this problem, you are given an authorized DNA sequence and an input DNA sequence. Your task is to determine whether the input DNA sequence can be accepted by the system.

A DNA sequence is accepted if the number of positions at which the input sequence differs from the authorized sequence is at most \( m \). Formally, if we denote the authorized sequence as \( A \) and the input as \( B \) (both of length \( n \)), then the sequence is accepted if:

\[ \sum_{i=1}^{n} \mathbb{1}_{\{A_i \neq B_i\}} \leq m \]

Otherwise, the sequence is rejected.

inputFormat

The input is given via stdin and consists of three lines:

  1. The first line contains two integers \( n \) and \( m \), where \( n \) represents the length of the authorized DNA sequence and \( m \) is the maximum number of allowed mismatches.
  2. The second line contains the authorized DNA sequence (a string of length \( n \)).
  3. The third line contains the input DNA sequence (a string of length \( n \)).

outputFormat

Output a single line to stdout:

  • True if the input DNA sequence is accepted (i.e. there are at most \( m \) mismatches),
  • False otherwise.
## sample
5 1
ACGTA
ACGTT
True

</p>