You have two strings of lowercase English letters. You can perform two types of operations on the first string:

Append a lowercase English letter to the end of the string.
Delete the last character of the string. Performing this operation on an empty string results in an empty string.

Given an integer, $\boldsymbol{\mbox{k}}$, and two strings, $\boldsymbol{\mathrm{~S~}}$ and $\boldsymbol{\boldsymbol{t}}$, determine whether or not you can convert $\boldsymbol{\mathrm{~S~}}$ to $\boldsymbol{\boldsymbol{t}}$ by performing exactly $\boldsymbol{\mbox{k}}$ of the above operations on $\boldsymbol{\mathrm{~S~}}$. If it's possible, print Yes.  Otherwise, print No.

Example. 
$s=[a,b,c]$ 

$t=[d,e,f]$ 

$k=6$  

To convert $\boldsymbol{\mathrm{~S~}}$ to $\boldsymbol{\boldsymbol{t}}$, we first delete all of the characters in $3$ moves.  Next we add each of the characters of $\boldsymbol{\boldsymbol{t}}$ in order.  On the $6^{th}$ move, you will have the matching string.  Return Yes.  

If there were more moves available, they could have been eliminated by performing multiple deletions on an empty string.  If there were fewer than $\boldsymbol{6}$ moves, we would not have succeeded in creating the new string.  

Function Description  

Complete the appendAndDelete function in the editor below.  It should return a string, either Yes or No.  

appendAndDelete has the following parameter(s):  

string s: the initial string  
string t: the desired string  
int k: the exact number of operations that must be performed  

Returns  

string: either Yes or No

Input Format

The first line contains a string $\boldsymbol{\mathrm{~S~}}$, the initial string. 

The second line contains a string $\boldsymbol{\boldsymbol{t}}$, the desired final string. 

The third line contains an integer $\boldsymbol{\mbox{k}}$, the number of operations.

Constraints

$1\leq|s|\leq100$
$1\leq|t|\leq100$
$1\leq k\leq100$
$\boldsymbol{\mathrm{~S~}}$ and $\boldsymbol{\boldsymbol{t}}$ consist of lowercase English letters, $\text{ascii[a-z]}$.

Sample Input 0
hackerhappy
hackerrank
9

Sample Output 0
Yes

Explanation 0

We perform $5$ delete operations to reduce string $\boldsymbol{\mathrm{~S~}}$ to hacker. Next, we perform $4$ append operations (i.e., r, a, n, and k), to get hackerrank. Because we were able to convert $\boldsymbol{\mathrm{~S~}}$ to $\boldsymbol{\boldsymbol{t}}$ by performing exactly $k=9$ operations, we return Yes.

Sample Input 1
aba
aba
7

Sample Output 1
Yes

Explanation 1

We perform $4$ delete operations to reduce string $\boldsymbol{\mathrm{~S~}}$ to the empty string.  Recall that though the string will be empty after $3$ deletions, we can still perform a delete operation on an empty string to get the empty string. Next, we perform $3$ append operations (i.e., a, b, and a). Because we were able to convert $\boldsymbol{\mathrm{~S~}}$ to $\boldsymbol{\boldsymbol{t}}$ by performing exactly $k=7$ operations, we return Yes.

Sample Input 2
ashley
ash
2

Sample Output 2
No

Explanation 2

To convert ashley to ash a minimum of $3$ steps are needed. Hence we print No as answer.

Source: hackerrank | Difficulty: EASY
Tags: Implementation


Solutions:
import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
lead = 0
for i in range(min(len(s), len(t))):
	if s[i] != t[i]:
		lead = i
		break
	else:
		lead = i + 1
d = len(s) - lead + len(t) - lead
if k >= len(s) + len(t):
	print('Yes')
elif d <= k and d % 2 == k % 2:
	print('Yes')
else:
	print('No')


s = input().strip()
t = input().strip()
k = int(input().strip())
ls = len(s)
lt = len(t)
lcp = 0
while lcp <= ls - 1 and lcp <= lt - 1 and (s[lcp] == t[lcp]):
	lcp += 1
if k >= ls + lt:
	print('Yes')
elif k >= ls + lt - 2 * lcp and (k - ls - lt + 2 * lcp) % 2 == 0:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
i = 0
while i < len(t) and i < len(s):
	if s[i] != t[i]:
		break
	i += 1
if i < len(s):
	k -= len(s[i:])
if i < len(t):
	k -= len(t[i:])
if k >= 0 and (k % 2 == 0 or k - 2 * i >= 0):
	print('Yes')
else:
	print('No')


s = input().strip()
t = input().strip()
(ls, lt) = map(len, (s, t))
k = int(input().strip())
if abs(ls - lt) > k:
	print('No')
elif ls + lt <= k:
	print('Yes')
else:
	for i in range(min(ls, lt)):
		if s[i] != t[i]:
			break
	u = ls - i
	v = lt - i
	if u + v > k or k - u + v & 1:
		print('No')
	else:
		print('Yes')


s = input()
t = input()
k = int(input())
n = len(s)
m = len(t)
i = 0
while i < n and i < m and (s[i] == t[i]):
	i += 1
if n - i + (m - i) <= k and ((k - (n - i) - (m - i)) % 2 == 0 or k - (n - i) - (m - i) >= 2 * i):
	print('Yes')
else:
	print('No')


from itertools import takewhile

def possible(s, t, k):
	if k >= len(s) + len(t):
		return True
	common = list(takewhile(lambda tp: tp[0] == tp[1], zip(s, t)))
	difference = len(s) + len(t) - 2 * len(common)
	if difference <= k and (not (difference - k) % 2):
		return True
	return False
s = input().strip()
t = input().strip()
k = int(input().strip())
print(possible(s, t, k) and 'Yes' or 'No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())

def appendDelete(s, t, k):
	if k >= len(s) + len(t):
		return True
	prefixLen = 0
	for (si, ti) in zip(s, t):
		if si == ti:
			prefixLen += 1
		else:
			break
	minSteps = len(s) - prefixLen + (len(t) - prefixLen)
	return minSteps <= k and (k - minSteps) % 2 == 0
print('Yes' if appendDelete(s, t, k) else 'No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
for i in range(len(t) + 1):
	if i >= len(s) or i >= len(t) or s[i] != t[i]:
		break
required = len(s) - i + len(t) - i
extra = k - required
if extra >= 0 and (extra % 2 == 0 or extra > 2 * i):
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
l = 0
for (a, b) in zip(s, t):
	if a == b:
		l += 1
	else:
		break
res = len(s) + len(t) - 2 * l
if res <= k and (k - res) % 2 == 0:
	print('Yes')
else:
	res = len(s) + len(t)
	if res <= k:
		print('Yes')
	else:
		print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
n = max(len(s) - k, 0)
ls = len(s)
lt = len(t)
cl = 0
for i in range(min(ls, lt)):
	if s[i] == t[i]:
		cl += 1
	else:
		break
if ls + lt <= k:
	print('Yes')
else:
	print('Yes' if (k - (ls + lt - 2 * cl)) % 2 == 0 and k >= ls - cl + (lt - cl) else 'No')


import sys

def solve(s, t, k):
	limit = min(len(s), len(t))
	for i in range(limit + 1):
		if i == limit or s[i] != t[i]:
			break
	common_count = i
	delete_count = max(0, len(s) - common_count)
	add_count = max(0, len(t) - common_count)
	if k < delete_count + add_count:
		return False
	k -= delete_count + add_count
	if k >= 2 * common_count:
		return True
	elif k % 2 == 0:
		return True
	else:
		return False
s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()
k = int(sys.stdin.readline())
if solve(s, t, k):
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if k > len(s) + len(t):
	print('Yes')
else:
	d = min(len(s), len(t))
	for x in range(d):
		if s[x] != t[x]:
			d = x
			break
	r = len(s) + len(t) - 2 * d
	if r > k or (k - r) % 2:
		print('No')
	else:
		print('Yes')


import sys
s = list(input().strip())
t = list(input().strip())
k = int(input().strip())
if len(s) + len(t) <= k:
	print('Yes')
else:
	while True:
		if len(s) > 0 and len(t) > 0 and (s[0] == t[0]):
			s.pop(0)
			t.pop(0)
		else:
			break
	if k - len(s) - len(t) >= 0 and (k - len(s) - len(t)) % 2 == 0:
		print('Yes')
	else:
		print('No')


s = input()
t = input()
k = int(input())
lens = len(s)
lent = len(t)
count = 0
for (i, j) in zip(s, t):
	if i != j:
		break
	count += 1
if lens + lent <= k:
	print('Yes')
elif k - lens + 2 * count - lent == 0:
	print('Yes')
elif (k - lens + 2 * count - lent) % 2 == 0 and k - lens + 2 * count - lent > 0:
	print('Yes')
else:
	print('No')


import sys

def solve(s, t, k):
	if len(s) + len(t) <= k:
		return True
	common_length = 0
	while common_length < len(s) and common_length < len(t) and (s[common_length] == t[common_length]):
		common_length += 1
	to_remove = len(s) - common_length
	to_add = len(t) - common_length
	to_change = to_remove + to_add
	if k < to_change:
		return False
	if (k - to_change) % 2 == 0:
		return True
	return False
s = input().strip()
t = input().strip()
k = int(input().strip())
print('Yes' if solve(s, t, k) else 'No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
same = 0
i = 0
while i < len(s) and i < len(t) and (s[i] == t[i]):
	i += 1
s1 = len(s[i:])
t1 = len(t[i:])
if s1 + t1 > k:
	print('No')
elif s1 + t1 == k:
	print('Yes')
elif len(s) + len(t) - k <= 0:
	print('Yes')
elif abs(len(s) + len(t) - k) % 2 == 0:
	print('Yes')
else:
	print('No')


def do():
	(s, t, k) = (input().strip(), input().strip(), int(input().strip()))
	lS = len(s)
	lT = len(t)
	if k >= lS + lT:
		print('Yes')
		return
	for i in range(min(lS, lT)):
		if s[i] != t[i]:
			break
	dif = lS + lT - 2 * i
	if k >= dif and (k - dif) % 2 == 0:
		print('Yes')
		return
	print('No')
	return
do()


string_A = input().strip()
string_B = input().strip()
number_of_operations = int(input().strip())
string_A_size = len(string_A)
string_B_size = len(string_B)
min_string_size = min(string_A_size, string_B_size)
common_string_size = 0
for (char_A, char_B) in zip(string_A[0:min_string_size], string_B[0:min_string_size]):
	if char_A != char_B:
		break
	common_string_size += 1
min_deletes = string_A_size - common_string_size
min_adds = string_B_size - common_string_size
min_operations = min_deletes + min_adds
operations_when_deleted = string_A_size + string_B_size
if number_of_operations < min_operations:
	print('No')
elif number_of_operations >= operations_when_deleted:
	print('Yes')
else:
	if min_operations % 2 == 0:
		number_of_operations_mod_result = 0
	else:
		number_of_operations_mod_result = 1
	if number_of_operations % 2 == number_of_operations_mod_result:
		print('Yes')
	else:
		print('No')


import sys

def is_obtainable(initial, desired, moves):
	smaller = min(len(initial), len(desired))
	common = 0
	for i in range(smaller):
		if initial[i] == desired[i]:
			common += 1
		else:
			break
	diff = abs(len(initial) - common) + abs(len(desired) - common)
	if diff > moves:
		return False
	if (moves - diff) % 2 == 0:
		return True
	if 2 * len(desired) <= moves:
		return True
	return False

def main(sinp=sys.stdin, sout=sys.stdout):
	initial = sinp.readline().strip()
	desired = sinp.readline().strip()
	moves = int(sinp.readline())
	sout.write('Yes' if is_obtainable(initial, desired, moves) else 'No')
main()


import sys

def common_prefix_length(source, target):
	common = 0
	for i in range(min(len(source), len(target))):
		if source[i] == target[i]:
			common += 1
		else:
			break
	return common
s = input().strip()
t = input().strip()
k = int(input().strip())

def can_reach(source, target, moves):
	cpl = common_prefix_length(source, target)
	moves_til_prefix_parity = len(source) - cpl
	remaining = moves - moves_til_prefix_parity
	if remaining < 0:
		return False
	extension_moves = len(target) - cpl
	if remaining < extension_moves:
		return False
	if 2 * cpl + extension_moves <= remaining:
		return True
	extra_moves = remaining - extension_moves
	if extra_moves % 2 == 0:
		return True
	return False
print('Yes' if can_reach(s, t, k) else 'No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
(S, T) = (len(s), len(t))
K = min(S, T)
for j in range(K):
	if s[j] != t[j]:
		break
else:
	j = K
if k >= S + T:
	print('Yes')
elif k < S + T - 2 * j:
	print('No')
elif k % 2 == (S + T - 2 * j) % 2:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
p = 0
for i in range(min([len(s), len(t)])):
	if s[:i + 1] == t[:i + 1]:
		p += 1
	else:
		break
if len(s) + len(t) - 2 * p == k:
	print('Yes')
elif len(s) + len(t) - 2 * p < k:
	diff = k - (len(s) + len(t) - 2 * p)
	if diff % 2 == 0 or diff >= 2 * p:
		print('Yes')
	else:
		print('No')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if k >= len(s) + len(t):
	print('Yes')
else:
	n = min(len(s), len(t))
	c = 0
	for i in range(n):
		if s[i] == t[i]:
			c += 1
		else:
			break
	ans = len(s) - c + len(t) - c
	if k < ans:
		print('No')
	elif (k - ans) % 2:
		print('No')
	else:
		print('Yes')


from itertools import zip_longest
s = input().strip()
t = input().strip()
k = int(input().strip())

def first_different_char(s, t):
	for (i, char) in enumerate(zip_longest(s, t)):
		if char[0] != char[1]:
			yield i
	yield len(s)
d = next(first_different_char(s, t))
ops = len(s[d:]) + len(t[d:])
if ops == k:
	print('Yes')
elif ops > k:
	print('No')
elif ops + 2 * len(s[:d]) <= k:
	print('Yes')
elif ops + 2 <= k and (k - ops) % 2 == 0:
	print('Yes')
else:
	print('No')


s = input()
t = input()
k = int(input())
i = 0
mi = min(len(s), len(t))
while i < mi and s[i] == t[i]:
	i += 1
diff = len(s) + len(t) - 2 * i
if k >= len(s) + len(t):
	print('Yes')
elif k >= diff and (k - diff) % 2 == 0:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
c = 0
for i in range(len(s)):
	if i < len(t) and s[i] == t[i]:
		c = c + 1
	else:
		break
z = len(s) + len(t) - 2 * c
if k >= len(s) + len(t):
	print('Yes')
elif z <= k and (k - z) % 2 == 0:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())

def isPossible(s, t, k):
	(m, n) = (len(s), len(t))
	dp = [[[0 for _ in range(k + 1)] for i in range(n + 1)] for j in range(m + 1)]
	for _ in range(k + 1):
		dp[0][0][_] = 1
	i = 0
	while i < n + 1 and i < m + 1:
		if s[:i] == t[:i]:
			dp[i][i][0] = 1
		i += 1
	for i in range(m + 1):
		for kk in range(i, k + 1):
			dp[i][0][kk] = 1
	for i in range(n + 1):
		for kk in range(i, k + 1):
			dp[0][i][kk] = 1
	for ii in range(m + 1):
		for jj in range(n + 1):
			for kk in range(k + 1):
				if kk - 1 < 0 or jj - 1 < 0 or ii - 1 < 0:
					continue
				dp[ii][jj][kk] = dp[ii][jj - 1][kk - 1] or dp[ii - 1][jj][kk - 1]
	if dp[m][n][k]:
		print('Yes')
	else:
		print('No')
isPossible(s, t, k)


(S, T) = (input().strip() for _ in range(2))
K = int(input().strip())
S_idx = T_idx = 0
(S_len, T_len) = (len(S), len(T))
while S_idx < S_len and T_idx < T_len and (S[S_idx] == T[T_idx]):
	S_idx += 1
	T_idx += 1
res_k = K - (len(S) - S_idx) - (len(T) - T_idx)
print('No' if res_k < 0 or (res_k & 1 and (S_idx >= res_k or 2 * S_idx > res_k)) else 'Yes')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if len(s) >= len(t):
	max_length = len(t)
else:
	max_length = len(s)
length = 0
for i in range(max_length):
	if s[i] == t[i]:
		length += 1
	else:
		break
min_step = len(s) - length + len(t) - length
if min_step > k:
	print('No')
elif length == len(s) and length == len(t) or length == 0:
	if k % 2 == 1:
		if k / 2 > length:
			print('Yes')
		else:
			print('No')
	else:
		print('Yes')
elif k >= len(t) + len(s):
	print('Yes')
elif (k - min_step) % 2 == 0:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
l = 0
for p in range(len(s)):
	if s[:p + 1] != t[:p + 1]:
		l = p
		break
if t[:len(s)] == s:
	l = len(s)
tot = len(s) - l + len(t) - l
if tot <= k and ((k - tot) % 2 == 0 or k >= len(s) + len(t)):
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
step = 0
index = -1
if k >= len(s) + len(t):
	print('Yes')
	sys.exit()
for i in range(len(s)):
	if i < len(t) and s[:i + 1] == t[:i + 1]:
		index = i
		tt = len(s) - 1 - i
		tt2 = len(t) - 1 - i
		if k == step + tt + tt2:
			print('Yes')
			sys.exit()
print('No')


def solve(s, t, k):
	n = len(s)
	m = len(t)
	if k >= n + m:
		return True
	for i in range(min(n, m)):
		if s[:i + 1] == t[:i + 1] and n - i - 1 + (m - i - 1) == k:
			return True
	return False
s = input()
t = input()
k = int(input())
print('Yes' if solve(s, t, k) else 'No')


import sys

def misind(s1, s2):
	for i in range(len(s1)):
		if i >= len(s2):
			return i
		if s1[i] != s2[i]:
			return i
	return len(s1)
s = input().strip()
t = input().strip()
k = int(input().strip())
mis = misind(s, t)
sleft = len(s) - mis
tleft = len(t) - mis
if len(s) + len(t) <= k:
	print('Yes')
elif sleft + tleft <= k and (tleft + k - sleft) % 2 == 0:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())

def economical(s, t, k):
	prefix = 0
	for i in range(min(len(s), len(t))):
		if s[i] == t[i]:
			prefix += 1
		else:
			break
	s = s[prefix:]
	t = t[prefix:]
	min_k = len(s) + len(t)
	k_must_be_even = len(s) % 2 == len(t) % 2
	k_mod2 = 0 if k_must_be_even else 1
	return k % 2 == k_mod2 and k >= min_k

def greedy(s, t, k):
	return k >= len(s) + len(t)
print('Yes' if economical(s, t, k) or greedy(s, t, k) else 'No')


s = input().strip()
t = input().strip()
k = int(input().strip())
if len(s) + len(t) < k:
	print('Yes')
	exit(0)
same_len = 0
for i in range(0, min(len(s), len(t))):
	if s[i] == t[i]:
		same_len += 1
	else:
		break
delete_num = len(s) - same_len
append_num = len(t) - same_len
min_operations = delete_num + append_num
if min_operations == k:
	print('Yes')
elif min_operations > k:
	print('No')
elif same_len == 0:
	print('Yes')
else:
	extra_operations = k - min_operations
	if extra_operations % 2 == 0:
		print('Yes')
	else:
		print('No')


import sys

def equal(short, tall):
	a = len(short)
	for i in range(len(short)):
		if short[i] != tall[i]:
			a = i
			break
	return a
s = input().strip()
t = input().strip()
k = int(input().strip())
if len(s) > len(t):
	i_min = len(s) - len(t) + (len(t) - equal(t, s)) * 2
elif len(s) < len(t):
	i_min = len(t) - len(s) + (len(s) - equal(s, t)) * 2
else:
	i_min = (len(s) - equal(t, s)) * 2
if k < i_min:
	print('No')
elif k <= len(s) + len(t):
	if (len(s) + len(t) - k) % 2 == 0:
		print('Yes')
	else:
		print('No')
elif k == i_min:
	print('Yes')
else:
	print('Yes')


import sys

def changeable(s, t, k):
	if len(s) + len(t) <= k:
		return 'Yes'
	if (len(s) + len(t) + k) % 2 == 1:
		return 'No'
	x = (len(s) + len(t) - k) // 2
	if s[:x] == t[:x]:
		return 'Yes'
	else:
		return 'No'
s = input().strip()
t = input().strip()
k = int(input().strip())
print(changeable(s, t, k))


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
n = min(len(s), len(t))
same = 0
while same < n and s[:same + 1] == t[:same + 1]:
	same += 1
ops = len(s) + len(t) - 2 * same
if ops <= k and (k - ops) % 2 == 0:
	print('Yes')
elif len(t) < k - len(s):
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
common = 0
slen = len(s)
tlen = len(t)
for i in range(min(slen, tlen)):
	if s[i] == t[i]:
		common += 1
	else:
		break
toadd = tlen - common
op = slen - common + toadd
if op > k:
	print('No')
else:
	diff = k - op
	if diff % 2 == 0:
		print('Yes')
	else:
		op += 2 * common
		if op > k:
			print('No')
		else:
			print('Yes')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
min_len = min(len(s), len(t))
d = 0
for i in range(min_len):
	if s[i] != t[i]:
		d = len(s) + len(t) - 2 * i
		break
if d == 0:
	d = abs(len(s) - len(t))
if k >= len(s) + len(t):
	print('Yes')
elif k >= d and (k - d) % 2 == 0:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
d = len(s) + len(t) - k
if d <= 0:
	print('Yes')
elif d & 1:
	print('No')
elif s[:d // 2] == t[:d // 2]:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
flag = False
for i in range(k):
	if len(s) - i < 0:
		dif = 0
		k -= 1
	else:
		dif = len(s) - i
	if s[:dif] == t[:dif] and len(s) - dif + len(t) - dif == k and (flag == False):
		flag = True
if flag:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if k > len(s) + len(t):
	print('Yes')
else:
	match = True
	i = 0
	while match:
		try:
			if s[i] == t[i]:
				match = True
			else:
				match = False
		except:
			match = False
		i += 1
	nDel = len(s) - i + 1
	nAp = len(t) - i + 1
	if k - nDel - nAp >= 0 and (k - nDel - nAp) % 2 == 0:
		print('Yes')
	else:
		print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
len_s = len(s)
len_t = len(t)
for i in range(min(len_s, len_t)):
	if s[i] != t[i]:
		upto = i
		break
else:
	upto = i + 1
k = k - (len_s - upto)
if k < 0:
	print('No')
elif len_t - upto == k:
	print('Yes')
elif len_t - upto > k:
	print('No')
else:
	k = k - (len_t - upto)
	if k > upto:
		if k >= 2 * upto:
			print('Yes')
		else:
			print('No')
	elif k % 2 == 0:
		print('Yes')
	else:
		print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
for i in range(k):
	stripped_s = s[:len(s) - i if len(s) - i > 0 else 0]
	if t.startswith(stripped_s) and len(t) - len(stripped_s) == k - i:
		print('Yes')
		sys.exit(0)
print('No')


s = input().strip()
t = input().strip()
k = int(input().strip())
while True:
	if not t.startswith(s):
		s = s[:-1]
		k -= 1
		continue
	adds = len(t) - len(s)
	if adds > k:
		print('No')
		break
	elif (adds - k) % 2 == 0:
		print('Yes')
		break
	s = s[:-1]
	k -= 1


def convertible(s, t, k):
	(m, n) = (len(s), len(t))
	i = 0
	while i < min(n, m) and s[i] == t[i]:
		i += 1
	c = m + n - 2 * i
	return k >= c and (not (k - c) % 2) or k >= m + n + 1
s = input()
t = input()
k = int(input())
print('Yes' if convertible(s, t, k) else 'No')


import sys

def yesno(s, t, k):
	s = list(s)
	t = list(t)
	del_count = 0
	end = len(s)
	while s[0:end] != t[0:end] and end > 0:
		s.pop()
		del_count += 1
		end -= 1
	rem_ops = k - del_count
	char_diff = len(t) - len(s)
	if rem_ops < char_diff:
		return 'No'
	elif rem_ops == char_diff:
		return 'Yes'
	elif (rem_ops - char_diff) % 2 == 0:
		return 'Yes'
	elif len(s) <= (rem_ops - char_diff - 1) / 2:
		return 'Yes'
	else:
		return 'No'
s = input().strip()
t = input().strip()
k = int(input().strip())
print(yesno(s, t, k))


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
cmn = 0
for i in range(min(len(s), len(t))):
	if s[i] != t[i]:
		break
	cmn += 1
bottom = len(s) - cmn + (len(t) - cmn)
top = len(s) + len(t)
if top <= k:
	print('Yes')
elif bottom <= k and k % 2 == bottom % 2:
	print('Yes')
else:
	print('No')


import sys

def doStuff(boo):
	if boo:
		print('Yes')
		sys.exit()
	else:
		print('No')
		sys.exit()
s = input().strip()
t = input().strip()
k = int(input().strip())
s_len = len(s)
t_len = len(t)
if s_len == 0 and t_len <= k:
	doStuff(True)
if t_len == 0 and s_len <= k:
	doStuff(True)
if s == t and (k % 2 == 0 or (k % 2 != 0 and k > 2 * s_len)):
	doStuff(True)
default_len = min(s_len, t_len)
common_chars = 0
for i in range(default_len):
	s_char = s[i]
	t_char = t[i]
	if s_char == t_char:
		common_chars += 1
	else:
		break
diff_s = s_len - common_chars
diff_t = t_len - common_chars
if diff_s + diff_t <= k and (k - (diff_s + diff_t)) % 2 == 0:
	doStuff(True)
elif diff_s + diff_t <= k and diff_s + diff_t + 2 * common_chars <= k:
	doStuff(True)
doStuff(False)


import sys

def get_prefix_size(s, t):
	c = 0
	for i in range(min(len(s), len(t))):
		if s[i] == t[i]:
			c += 1
		else:
			break
	return c
s = input().strip()
t = input().strip()
k = int(input().strip())
can_do = False
if k >= len(s) + len(t):
	can_do = True
else:
	ps = get_prefix_size(s, t)
	k -= len(s) + len(t) - 2 * ps
	if k >= 0 and k % 2 == 0:
		can_do = True
if can_do:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if len(s) < len(t):
	m = len(s)
else:
	m = len(t)
i = 0
while i < m:
	if s[i] != t[i]:
		break
	i += 1
rm_count = len(s) - i
add_count = len(t) - i
count = rm_count + add_count
if k < count:
	print('No')
elif k == count:
	print('Yes')
elif k >= len(s) + len(t):
	print('Yes')
elif (k - count) % 2 == 0:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
len_s = len(s)
len_t = len(t)
if len_s <= len_t:
	tmp = len_s
else:
	tmp = len_t
count = 0
for i in range(tmp):
	if s[i] == t[i]:
		count = count + 1
	else:
		break
if k >= len_s + len_t:
	print('Yes')
	exit()
elif k - len_s - len_t + 2 * count >= 0 and (k - len_s - len_t + 2 * count) % 2 == 0:
	print('Yes')
else:
	print('No')


s = input().strip()
t = input().strip()
k = int(input().strip())
i = 0
l = len(s)
m = len(t)
l = min(l, m)
while i < l and s[i] == t[i]:
	i = i + 1
a = len(s[i:])
b = len(t[i:])
x = a + b
if x <= k:
	left = k - x
	i = i - 1
	while left > 2 and i > -1:
		i = i - 1
		left = left - 2
	if left == 1 and i > -1:
		print('No')
	else:
		print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
s = list(s)
t = list(t)
while len(s) > len(t):
	s.pop()
	k -= 1
if k < 0:
	print('No')
	exit(0)
if ''.join(s) == ''.join(t):
	if k % 2 == 0:
		print('Yes')
		exit(0)
	elif k > len(s) * 2:
		print('Yes')
		exit(0)
	else:
		print('No')
		exit(0)
pos = -1
if k > len(s) + len(t):
	print('Yes')
	exit(0)
for i in range(0, len(s)):
	if s[i] != t[i]:
		pos = i
		break
if pos == -1:
	pos = len(s)
num = len(t) - pos
k = k - (len(s) - pos + num)
if k < 0:
	print('No')
	exit(0)
if k == 0:
	print('Yes')
	exit(0)
if k % 2 == 0:
	print('Yes')
	exit(0)
else:
	print('No')


import sys
a = input().strip()
b = input().strip()
k = int(input().strip())
(la, lb) = (len(a), len(b))
s = 0
for i in range(min(la, lb)):
	if a[i] != b[i]:
		break
	else:
		s += 1
k_min = la - s + (lb - s)
if k >= k_min:
	if k == k_min or k >= k_min + 2 * s or (k - k_min) % 2 == 0:
		print('Yes')
	else:
		print('No')
else:
	print('No')


def get_same_prefix(s, t):
	prefix = 0
	while prefix < len(s) and prefix < len(t) and (s[prefix] == t[prefix]):
		prefix += 1
	return prefix

def main():
	s = input()
	t = input()
	k = int(input())
	prefix = get_same_prefix(s, t)
	ops = len(s) + len(t) - 2 * prefix
	if k == ops:
		return True
	if k < ops:
		return False
	if k >= 2 * prefix + ops:
		return True
	if (k - ops) % 2 == 0:
		return True
if main():
	print('Yes')
else:
	print('No')


s = input().strip()
t = input().strip()
k = int(input().strip())
l = len(s)
if s == t and k > l * 2:
	print('Yes')
elif k >= l + len(t):
	print('Yes')
else:
	temp = 0
	for i in range(l, 0, -1):
		s1 = s[0:i]
		t1 = t[0:i]
		if s1 == t1:
			temp = l - i
			break
	if k - temp == len(t) - len(t1):
		print('Yes')
	elif k - temp > len(t) - len(t1) and (len(t) - len(t1)) % 2 == 0:
		print('Yes')
	else:
		print('No')


import sys

def result(lens, lent, k, i, req):
	if req == k:
		return 1
	if req < k and (req - k) % 2 == 0:
		return 1
	if k > lens + lent:
		return 1
	return 0
s = input().strip()
t = input().strip()
k = int(input().strip())
lens = len(s)
lent = len(t)
i = 0
while i < lens and i < lent and (s[i] == t[i]):
	i += 1
req = lens - i + (lent - i)
if result(lens, lent, k, i, req) == 1:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
ls = len(s)
lt = len(t)
same = 0
for i in range(min(ls, lt)):
	if s[i] == t[i]:
		same += 1
		continue
	break
just_the_tip = k - (ls - same + (lt - same))
if just_the_tip >= 0 and just_the_tip % 2 == 0:
	print('Yes')
elif k >= ls + lt:
	print('Yes')
else:
	print('No')


import sys

def can_convert(s, t, k):
	if len(s) + len(t) <= k:
		return True
	i = 0
	while i < len(s) and i < len(t) and (s[i] == t[i]):
		i += 1
	same_until = i
	deletes_needed = len(s) - same_until
	appends_needed = len(t) - same_until
	operations_left = k - deletes_needed - appends_needed
	if operations_left >= 0 and operations_left % 2 == 0:
		return True
	return False
s = input().strip()
t = input().strip()
k = int(input().strip())
if can_convert(s, t, k):
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
i = 0
while i < len(s) and i < len(t):
	if s[i] != t[i]:
		break
	i += 1
a = len(s) - i
b = len(t) - i
if a + b == k:
	print('Yes')
elif len(s) + len(t) <= k:
	print('Yes')
elif a + b < k and (k - a - b) % 2 == 0:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if k >= len(s) + len(t):
	print('Yes')
else:
	count = 0
	for i in range(min(len(s), len(t))):
		if s[i] != t[i]:
			count = i
			break
	else:
		count = min(len(s), len(t))
	ops = len(s) + len(t) - 2 * count
	if ops <= k and (k - ops) % 2 == 0:
		print('Yes')
	else:
		print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if len(s) + len(t) <= k:
	print('Yes')
else:
	m = 0
	for (i, j) in zip(s, t):
		if i == j:
			m += 1
		else:
			break
	s = s[m:]
	t = t[m:]
	lens = len(s) + len(t)
	if k < lens:
		print('No')
	elif k % 2 == lens % 2:
		print('Yes')
	else:
		print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if len(s) + len(t) <= k:
	print('Yes')
	sys.exit(0)
try:
	for i in range(len(s)):
		if s[i] != t[i]:
			break
except IndexError:
	pass
steps = k - (len(s) - i + len(t) - i)
if steps < 0 or steps % 2:
	print('No')
else:
	print('Yes')


import sys

def main():
	s = input().strip()
	t = input().strip()
	k = int(input().strip())
	m = 0
	for c in s:
		if s[:m + 1] != t[:m + 1]:
			break
		m += 1
	n = len(s[m:]) + len(t[m:])
	if n > k:
		print('No')
		exit(0)
	elif n == k or (k - n) % 2 == 0:
		print('Yes')
		exit(0)
	elif k > len(s) + len(t):
		print('Yes')
		exit(0)
	else:
		print('No')
main()


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if k >= len(s) + len(t):
	print('Yes')
elif (len(s) + len(t) - k) % 2 == 1:
	print('No')
else:
	num_matches = 0
	for i in range(min(len(s), len(t))):
		if s[:i] == t[:i]:
			num_matches = i
	if k >= len(s) + len(t) - 2 * num_matches:
		print('Yes')
	else:
		print('No')


s = input()
t = input()
k = int(input())
S = len(s)
T = len(t)
l = 0
for i in range(min(S, T)):
	if s[i] == t[i]:
		l += 1
	else:
		break
K = k - (T - l + S - l)
if K >= 0 and K % 2 == 0 or 2 * l <= K:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
index = 0
while index < len(s) and index < len(t):
	if s[index] != t[index]:
		break
	index += 1
op_req = 0
if index == len(t):
	op_req = len(s) - index
if index == len(s):
	op_req = len(t) - index
if index != len(s) and index != len(t):
	op_req = len(s) - index + len(t) - index
if op_req > k:
	print('No')
elif op_req == k:
	print('Yes')
elif k - op_req >= 2 * index:
	print('Yes')
elif (k - op_req) % 2 == 0:
	print('Yes')
else:
	print('No')


s = input().strip()
t = input().strip()
k = int(input().strip())
if k >= len(s) + len(t):
	print('Yes')
else:
	for (i, j) in zip(range(len(s)), range(len(t))):
		if s[i] != t[j]:
			break
	(x, y) = (len(s[i if i != 0 else 1:]), len(t[j if j != 0 else 1:]))
	minop = x + y if x >= y else y - x
	print('Yes' if minop == k or ((k - minop) % 2 == 0 and k - minop >= 0) else 'No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if s == t:
	if k % 2 == 0 or k >= 2 * len(s):
		print('Yes')
	else:
		print('No')
else:
	while s != t and k > 0:
		if s == '':
			if k > len(t):
				k -= 1
		if len(s) > len(t) or s != t[:len(s)]:
			s = s[:-1]
		else:
			s = s + t[len(s)]
		k -= 1
	if k == 0:
		if s == t:
			print('Yes')
		else:
			print('No')
	elif s == t:
		if k % 2 == 0 or k >= 2 * len(s):
			print('Yes')
		else:
			print('No')
	else:
		print('No')


import sys

def countelement(a, b):
	count = 0
	for i in range(min(len(a), len(b))):
		if a[i] == b[i]:
			count += 1
		else:
			break
	return count

def solve(s, t, k):
	if k >= len(s) + len(t):
		return 'Yes'
	c = countelement(s, t)
	result = len(s) + len(t) - 2 * c
	if result == k:
		return 'Yes'
	elif k > result and (k - result) % 2 == 0:
		return 'Yes'
	else:
		return 'No'
s = input()
t = input()
k = int(input().strip())
print(solve(s, t, k))


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if k >= len(s) + len(t):
	print('Yes')
else:
	shorter = s
	longer = t
	if len(s) > len(t):
		shorter = t
		longer = s
	idxNot = len(shorter)
	for (i, c) in enumerate(shorter):
		if c != longer[i]:
			idxNot = i
			break
	toDelete = len(s) - idxNot
	minChange = toDelete + (len(t) - idxNot)
	if k >= minChange:
		if (k - minChange) % 2 == 0:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
isPossible = False
if k >= len(s) + len(t):
	isPossible = True
elif s == t:
	if k % 2 == 0:
		isPossible = True
else:
	k -= abs(len(s) - len(t))
	if len(s) <= len(t):
		l = len(s)
	else:
		l = len(t)
	isEqual = True
	for i in range(l):
		if s[i] != t[i]:
			isEqual = False
			k -= 2 * (l - i)
			if k == 0:
				isPossible = True
			if k > 0 and k % 2 == 0:
				isPossible = True
			break
	if isEqual:
		if k == 0:
			isPossible = True
		if k > 0 and k % 2 == 0:
			isPossible = True
if isPossible:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
i = 0
while i < len(s) and i < len(t) and (s[i] == t[i]):
	i = i + 1
b = len(s) - i
a = len(t) - i
if b == len(s):
	if k - (b + a) >= 0:
		print('Yes')
	else:
		print('No')
elif k >= b + a:
	k = k - (b + a)
	if k == 0:
		print('Yes')
	elif k % 2 == 0 or k >= 2 * len(t):
		print('Yes')
	else:
		print('No')
else:
	print('No')


import sys
import itertools
s = input().strip()
t = input().strip()
k = int(input().strip())
common = itertools.takewhile(lambda x: x[0] == x[1], zip(s, t))
common_len = len(list(common))
spec_len = len(s) + len(t) - 2 * common_len
if k >= spec_len and (spec_len - k) % 2 == 0:
	print('Yes')
elif k >= spec_len + common_len * 2:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input())
ls = len(s)
lt = len(t)
if k >= ls + lt:
	print('Yes')
else:
	lp = 0
	while lp < ls and lp < lt and (s[lp] == t[lp]):
		lp += 1
	mink = ls - lp + (lt - lp)
	if k >= mink and k % 2 == mink % 2:
		print('Yes')
	else:
		print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if s == t:
	if len(s) < k:
		print('Yes')
	elif k % 2 == 0:
		print('Yes')
	else:
		print('No')
else:
	if len(s) <= len(t):
		mn = len(s)
		mx = len(t)
	else:
		mn = len(t)
		mx = len(s)
	count = True
	for i in range(mn):
		if s[i] != t[i]:
			if mn - i + (mx - i) <= k:
				count = False
				print('Yes')
				break
			else:
				count = False
				print('No')
				break
	if count == True:
		if (k - (mx - mn)) % 2 == 0:
			print('Yes')
		else:
			print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if len(s) + len(t) <= k:
	print('Yes')
else:
	i = 0
	while i < min(len(s), len(t)) and s[i] == t[i]:
		i += 1
	nOpsMin = len(s) - i + (len(t) - i)
	if nOpsMin > k:
		print('No')
	elif nOpsMin == k:
		print('Yes')
	elif (k - nOpsMin) % 2 == 0:
		print('Yes')
	elif (k - nOpsMin) / 2 >= i:
		print('Yes')
	else:
		print('No')


import sys
s = list(input().strip())
t = list(input().strip())
k = int(input().strip())

def common_index(a, b):
	for i in range(len(a)):
		if i == len(b):
			return i
		if a[i] != b[i]:
			return i
	return len(s)

def is_both_same(a, b):
	if a % 2 == 0 and b % 2 == 0:
		return True
	if a % 2 == 1 and b % 2 == 1:
		return True
	return False
c = common_index(s, t)
if c == len(t) == len(s):
	if k <= 2 * c and k % 2 == 0:
		print('Yes')
	elif k <= 2 * c:
		print('No')
	else:
		print('Yes')
elif c == 0:
	if k >= len(s) + len(t):
		print('Yes')
	else:
		print('No')
else:
	m = len(t) + len(s) - 2 * c
	if m <= k < len(s) + len(t):
		if is_both_same(k, m):
			print('Yes')
		else:
			print('No')
	elif k >= len(s) + len(t):
		print('Yes')
	else:
		print('No')


import re
source = input()
target = input()
k = int(input())
s = source
l = len(source)
rr = l
count = 0
while re.search(s, target) == None:
	l = l - 1
	s = source[0:l]
	count = count + 1
count = count + len(target) + len(source) - len(s)
count = 0
for i in range(len(source)):
	if i < len(target) and source[i] == target[i]:
		count = count + 1
	else:
		break
count = len(source) + len(target) - 2 * count
if source == target:
	if k <= 2 * rr:
		if k % 2 == 0:
			print('Yes')
		else:
			print('No')
	else:
		print('Yes')
elif k - count >= 0:
	if k <= len(source) + len(target):
		if (k - count) % 2 == 0:
			print('Yes')
		else:
			print('No')
	else:
		print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if len(s) + len(t) <= k:
	print('Yes')
	sys.exit()
count_s = 0
count_t = 0
flag = 0
index = 9999
for i in range(len(s)):
	if flag == 0:
		try:
			if s[i] == t[i]:
				continue
		except:
			pass
	if flag == 0:
		index = i
	flag = 1
	count_s += 1
flag = 0
for i in range(len(t)):
	if flag == 0:
		try:
			if s[i] == t[i]:
				continue
		except:
			pass
	flag = 1
	count_t += 1
if index != 0:
	if k - count_s - count_t >= 0:
		if (k - count_s - count_t) % 2 == 0:
			print('Yes')
			sys.exit()
print('No')


import sys

def solve():
	s = input().strip()
	t = input().strip()
	k = int(input().strip())
	if k >= len(s) + len(t):
		return 'Yes'
	if s == t and k % 2 == 0:
		return 'Yes'
	if s == t and k % 2 == 1 and (k < len(s) + len(t)):
		return 'No'
	same = 0
	for i in range(min(len(s), len(t))):
		if s[i] == t[i]:
			same += 1
		else:
			break
	if len(s[same:]) + len(t[same:]) > k:
		return 'No'
	elif len(s[same:]) + len(t[same:]) == k:
		return 'Yes'
	elif (len(s[same:]) + len(t[same:])) % 2 and k % 2:
		return 'Yes'
	elif (len(s[same:]) + len(t[same:])) % 2 == 0 and k % 2 == 0:
		return 'Yes'
	return 'No'
print(solve())


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
ls = len(s)
lt = len(t)
if k >= ls + lt:
	print('Yes')
else:
	ix = 0
	while ix < ls and ix < lt and (s[ix] == t[ix]):
		ix += 1
	minMoves = ls - ix + (lt - ix)
	if k >= minMoves and (minMoves - k) % 2 == 0:
		print('Yes')
	else:
		print('No')


import sys
from itertools import zip_longest

def diffindex(string1, string2):
	for (i, (char1, char2)) in enumerate(zip_longest(string1, string2)):
		if char1 != char2:
			return i
	return len(string1)
s = input().strip()
t = input().strip()
k = int(input().strip())
if len(s) + len(t) <= k:
	print('Yes')
else:
	diff = diffindex(s, t)
	remaining_moves = k - (len(s) - diff + (len(t) - diff))
	if remaining_moves < 0:
		print('No')
	elif remaining_moves % 2 == 0:
		print('Yes')
	else:
		print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
a = list(s)
b = list(t)
la = len(a)
lb = len(b)
lmin = min(la, lb)
lmax = max(la, lb)
i = 0
while i < lmin:
	if a[i] != b[i]:
		break
	i += 1
ops = lmax + lmin - 2 * i
if lmax + lmin <= k:
	print('Yes')
elif (k - ops) % 2 == 0 and k >= ops:
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
flag = len(s) + len(t)
if s == t:
	print('Yes')
elif len(s) >= len(t):
	if k > flag:
		print('Yes')
	else:
		diff = 0
		for i in range(len(t)):
			if s[i] == t[i]:
				diff += 1
			else:
				break
		digit = len(s) - diff + len(t) - diff
		if k == digit:
			print('Yes')
		elif k > digit:
			if digit != 0 and (k - digit) % 2 == 0:
				print('Yes')
			else:
				print('No')
		else:
			print('No')
elif len(t) > len(s):
	if k > flag:
		print('Yes')
	else:
		diff = 0
		for i in range(len(s)):
			if s[i] == t[i]:
				diff += 1
			else:
				break
		digit = len(s) - diff + len(t) - diff
		if k == digit:
			print('Yes')
		elif k > digit:
			if digit != 0 and (k - digit) % 2 == 0:
				print('Yes')
			else:
				print('No')
		else:
			print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())

def solve(s, t, k):
	ls = len(s)
	lt = len(t)
	for (i, (a, b)) in enumerate(zip(s, t)):
		if a != b:
			break
	rs = ls - i
	rt = lt - i
	rk = k - rs - rt
	if rk < 0:
		return False
	if rk % 2 == 0:
		return True
	if rk / 2 >= i:
		return True
	return False
if solve(s, t, k):
	print('Yes')
else:
	print('No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
(n, m) = (len(s), len(t))
same = 0
while same < n and same < m and (s[same] == t[same]):
	same += 1
k -= n + m - 2 * same
print('Yes' if k >= 0 and (k >= 2 * same or k % 2 == 0) else 'No')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
n = len(s)
m = len(t)
tlen = min(n, m)
pos = tlen
for i in range(0, tlen):
	if s[i] != t[i]:
		pos = i
		break
k -= n - pos
k -= m - pos
print('No' if k < 0 or (k % 2 != 0 and k < 2 * pos) else 'Yes')


import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
if len(s) > len(t):
	length = len(t)
else:
	length = len(s)
if s == t and k % 2 != 0 and (k < length):
	print('No')
elif len(s) + len(t) <= k:
	print('Yes')
else:
	i = 0
	count = 0
	while i < length:
		if s[i] == t[i]:
			count += 1
		else:
			break
		i += 1
	step = len(s) - count + (len(t) - count)
	if step <= k and (k - step) % 2 == 0:
		print('Yes')
	else:
		print('No')


import sys
s = input().strip()
sl = len(s)
t = input().strip()
tl = len(t)
k = int(input().strip())
i = 0
for q in range(min(sl, tl)):
	if s[i] != t[i]:
		break
	i += 1
tmpk = k - (sl - i)
tmpk -= tl - i
print('Yes' if tmpk % 2 == 0 and tmpk >= 0 or k >= tl + sl else 'No')


import sys

def count_same(s, t):
	c = 0
	for (ss, ts) in zip(s, t):
		if ss == ts:
			c += 1
		else:
			return c
	return c
s = input().strip()
t = input().strip()
k = int(input().strip())
if k >= len(s) + len(t):
	print('Yes')
else:
	c = count_same(s, t)
	diff = len(s) - c + (len(t) - c)
	if diff <= k:
		if (k - diff) % 2 == 0:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


def check(s, t, k):
	if s[0] != t[0]:
		return k >= len(s) + len(t)
	if k >= len(s) + len(t):
		return True
	L = [i for i in range(0, min(len(s), len(t))) if s[i] != t[i]]
	if len(L) == 0:
		minSteps = abs(len(s) - len(t))
	else:
		minSteps = len(s) - L[0] + len(t) - L[0]
	return k >= minSteps and (k - minSteps) % 2 == 0
import sys
s = input().strip()
t = input().strip()
k = int(input().strip())
b = check(s, t, k)
if b:
	print('Yes')
else:
	print('No')


s = input().strip()
t = input().strip()
k = int(input().strip())
ls = len(s)
lt = len(t)
same = 0
for i in range(min(ls, lt)):
	if s[i] == t[i]:
		same += 1
	else:
		break
k = k - (ls - same)
ls = same
k = k - (lt - ls)
if k < 0 or (k < 2 * ls and k % 2):
	print('No')
else:
	print('Yes')


import sys

def find_common_starting(s, t):
	m = min(len(s), len(t))
	for i in range(m):
		if s[i] != t[i]:
			return i
	return m

def check(s, t, k):
	common = find_common_starting(s, t)
	(ls, lt) = (len(s), len(t))
	(min_l, max_l) = (min(ls, lt), max(ls, lt))
	if ls + lt <= k:
		return True
	ops = ls - common + (lt - common)
	if k == ops:
		return True
	if k > ops and (k - ops) % 2 == 0:
		return True
	return False
s = input().strip()
t = input().strip()
k = int(input().strip())
if check(s, t, k):
	print('Yes')
else:
	print('No')