#K76902. Taco Transformation

    ID: 34745 Type: Default 1000ms 256MiB

Taco Transformation

Taco Transformation

Given two strings str1 and str2, and an integer k, you are to determine if it is possible to transform str1 into str2 using exactly k operations.

In one operation, you can either delete the last character of the current string or append any character to the end of the current string.

Let \(L_1\) and \(L_2\) denote the lengths of str1 and str2, respectively, and let \(c\) be the length of the longest common prefix of both strings. The minimum number of operations required to transform str1 into str2 is given by:

\(total = (L_1 - c) + (L_2 - c)\)

The transformation is possible if and only if total \le k and the difference \(k - total\) is even (i.e., \((k - total) \mod 2 = 0\)).

inputFormat

The input is read from stdin and consists of three lines:

  1. The first line contains the string str1.
  2. The second line contains the string str2.
  3. The third line contains the integer k.

outputFormat

Output a single line to stdout:

  • Yes if the transformation from str1 to str2 in exactly k operations is possible.
  • No otherwise.
## sample
abc
def
6
Yes