Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It is represented by a string that consists of lowercase Latin letters.

Dwarf Misha has already chosen the subject for his thesis: determining by two dwarven genomes, whether they belong to the same race. Two dwarves belong to the same race if we can swap two characters in the first dwarf's genome and get the second dwarf's genome as a result. Help Dwarf Misha and find out whether two gnomes belong to the same race or not.

Input

The first line contains the first dwarf's genome: a non-empty string, consisting of lowercase Latin letters.

The second line contains the second dwarf's genome: a non-empty string, consisting of lowercase Latin letters.

The number of letters in each genome doesn't exceed 105. It is guaranteed that the strings that correspond to the genomes are different. The given genomes may have different length.

Output

Print "YES", if the dwarves belong to the same race. Otherwise, print "NO".

Examples

Input

ab
ba


Output

YES


Input

aa
ab


Output

NO

Note

  * First example: you can simply swap two letters in string "ab". So we get "ba". 
  * Second example: we can't change string "aa" into string "ab", because "aa" does not contain letter "b".

Source: codeforces | Difficulty: EASY
Tags: String algorithms

Implementation


Solutions:
g1 = list(input())
g2 = list(input())
cntr = 0
if sorted(g1) != sorted(g2):
	print('NO')
else:
	for i in range(len(g1)):
		if g1[i] != g2[i]:
			cntr = cntr + 1
	if cntr == 2:
		print('YES')
	else:
		print('NO')


from collections import Counter

def main(d1, d2):
	diff = sum((1 for (x, y) in zip(d1, d2) if x != y))
	if Counter(d1) == Counter(d2) and diff == 2:
		return 'YES'
	return 'NO'
(d1, d2) = (input(), input())
d1 = d1.replace('\n', '')
d2 = d2.replace('\n', '')
print(main(d1, d2))


from collections import Counter
a = input()
b = input()
if len(a) != len(b):
	print('NO')
else:
	aa = Counter(a)
	bb = Counter(b)
	if aa == bb:
		ind = 0
		for i in range(len(a)):
			if a[i] == b[i]:
				ind += 1
		if ind == len(a) - 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


(s, p) = (str(input()), str(input()))
if len(s) != len(p):
	print('NO')
else:
	index = []
	for j in range(len(s)):
		if s[j] != p[j]:
			index.append(j)
			if len(index) > 2:
				break
	if len(index) == 2:
		if s[index[0]] == p[index[1]] and s[index[1]] == p[index[0]]:
			print('YES')
		else:
			print('NO')
	elif len(index) == 0:
		print('YES')
	else:
		print('NO')


a = input()
b = input()
mismatch = 0
s_1 = ''
s_2 = ''
for i in range(min(len(a), len(b))):
	if a[i] != b[i]:
		mismatch += 1
		s_1 += a[i]
		s_2 += b[i]
if mismatch != 2:
	print('NO')
elif len(a) != len(b):
	print('NO')
elif s_1[::-1] == s_2:
	print('YES')
else:
	print('NO')


s = input()
t = input()
print(['NO', 'YES'][sorted(s) == sorted(t) and sum([1 for (i, j) in zip(s, t) if i != j]) == 2])


def snr(f, s):
	lf = len(f)
	if lf != len(s):
		return 0
	(fv, sv) = ([], [])
	for c in range(lf):
		if f[c] == s[c]:
			continue
		else:
			if len(fv) > 2:
				return 0
			fv.append(f[c])
			sv.append(s[c])
	if len(fv) == 2 and (fv == sv or fv == sv[::-1]):
		return 1
	return 0
(f, s) = (input(), input())
t = 'NO'
if snr(f, s):
	t = 'YES'
print(t)


first = list(str(input()))
second = list(str(input()))
f = first.copy()
s = second.copy()
(fen, sen) = (len(first), len(second))
c = 0
c1 = []
flag = True
if fen != sen:
	print('NO')
else:
	for i in range(fen):
		if f[i] != s[i]:
			c += 1
			c1.append(i)
		if c == 3:
			flag = False
			break
	if flag and c == 2:
		if f[c1[0]] == s[c1[1]] and f[c1[1]] == s[c1[0]]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


a = input()
b = input()
len1 = len(a)
len2 = len(b)
if len1 != len2:
	print('NO')
else:
	lista = []
	for t in range(len1):
		if a[t] != b[t]:
			lista.append(t)
	if len(lista) != 2:
		print('NO')
	else:
		x = lista[0]
		y = lista[1]
		if a[x] == b[y] and b[x] == a[y]:
			print('YES')
		else:
			print('NO')


genome1 = list(input())
genome2 = list(input())
indexs = []
flag = 0
for i in range(min(len(genome2), len(genome1))):
	if genome1[i] != genome2[i]:
		indexs.append(i)
if len(indexs) <= 1 or len(indexs) > 2:
	print('NO')
	exit()
(genome1[indexs[0]], genome1[indexs[1]]) = (genome1[indexs[1]], genome1[indexs[0]])
if genome1 == genome2:
	print('YES')
else:
	print('NO')


a = input()
b = input()
count = 0
lettera1 = '1'
letterb1 = '2'
lettera2 = '3'
letterb2 = '4'
if len(a) != len(b):
	print('NO')
	exit(0)
for i in range(len(a)):
	if a[i] != b[i]:
		if count == 0:
			lettera1 = a[i]
			letterb1 = b[i]
		else:
			lettera2 = a[i]
			letterb2 = b[i]
		count += 1
		if count > 2:
			print('NO')
			exit(0)
if lettera1 == letterb2 and lettera2 == letterb1:
	print('YES')
else:
	print('NO')


a = list(input())
b = list(input())
if len(a) != len(b):
	print('NO')
	exit()
if len(a) == 2:
	if a != b[::-1]:
		print('NO')
		exit()
	else:
		print('YES')
		exit()
c = 0
temp = -1
for i in range(len(a)):
	if a[i] != b[i]:
		c += 1
		if temp == -1 and c == 1:
			temp = i
		else:
			(b[i], b[temp]) = (b[temp], b[i])
a = ''.join(a)
b = ''.join(b)
if c != 2:
	print('NO')
elif a == b:
	print('YES')
else:
	print('NO')


a = input()
b = input()
k1 = []
k2 = []
k3 = []
if len(a) != len(b):
	print('NO')
else:
	for i in range(len(a)):
		if a[i] == b[i]:
			k1.append(a[i])
		else:
			k2.append(a[i])
			k3.append(b[i])
	k3 = sorted(k3)
	k2 = sorted(k2)
	if k2 == k3 and len(k2) == 2:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
ans = ''
cnt = 0
if len(s1) != len(s2):
	ans = 'NO'
else:
	pos = []
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			cnt += 1
			pos.append(i)
		if cnt > 2:
			ans = 'NO'
			break
	if len(pos) != 2:
		ans = 'NO'
	else:
		arr_s1 = []
		arr_s2 = []
		for (char1, char2) in zip(s1, s2):
			arr_s1.append(char1)
			arr_s2.append(char2)
		(arr_s1[pos[0]], arr_s1[pos[1]]) = (arr_s1[pos[1]], arr_s1[pos[0]])
		s1 = ''.join(arr_s1)
		s2 = ''.join(arr_s2)
	if s1 == s2:
		ans = 'YES'
	else:
		ans = 'NO'
print(ans)


def main():
	s1 = list(input())
	s2 = list(input())
	if len(s1) != len(s2):
		return False
	diff = []
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			diff.append(i)
	if len(diff) == 0:
		return True
	if len(diff) != 2:
		return False
	return s1[diff[0]] == s2[diff[1]] and s2[diff[0]] == s1[diff[1]]
print('YES') if main() else print('NO')


s1 = input()
s2 = input()
if sorted(s1) == sorted(s2):
	diff = 0
	flag = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			diff += 1
		if diff > 2:
			print('NO')
			flag = 1
			break
	if flag == 0:
		if diff == 2:
			print('YES')
		else:
			print('NO')
else:
	print('NO')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
else:
	found = False
	cnt = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			if found:
				if a[i] == pair[1] and b[i] == pair[0]:
					ok = True
				else:
					ok = False
				cnt += 1
			else:
				found = True
				pair = (a[i], b[i])
	if cnt == 1 and ok:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
dic1 = {}
dic2 = {}
a = 'abcdefghijklmnopqrstuvwxyz'
if len(s1) != len(s2):
	print('NO')
	exit()
for i in range(26):
	dic1[a[i]] = 0
	dic2[a[i]] = 0
for i in range(len(s1)):
	dic1[s1[i]] += 1
for i in range(len(s2)):
	dic2[s2[i]] += 1
boo = True
for i in range(len(s2)):
	if dic2[s2[i]] != dic1[s2[i]]:
		boo = False
		break
if not boo:
	print('NO')
else:
	c = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			c += 1
	if c == 2:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
else:
	n = len(s1)
	diffs = []
	for x in range(n):
		if s1[x] != s2[x]:
			diffs.append(x)
	if not len(diffs):
		print('YES')
	elif len(diffs) != 2:
		print('NO')
	elif s1[diffs[0]] == s2[diffs[1]] and s2[diffs[0]] == s1[diffs[1]]:
		print('YES')
	else:
		print('NO')


s1 = [x for x in input()]
s2 = [x for x in input()]
l1 = len(s1)
l2 = len(s2)
if l1 != l2:
	print('NO')
else:
	if l1 < l2:
		l = l1
		(s, s1) = (s1, s2)
	else:
		l = l2
		(s, s1) = (s2, s1)
	cnt = [0, 0]
	j = 0
	flag = 0
	for i in range(l):
		if s[i] != s1[i]:
			cnt[j] = i
			j += 1
			if j == 2:
				(s[cnt[0]], s[cnt[1]]) = (s[cnt[1]], s[cnt[0]])
				if s == s1:
					flag += 1
					print('YES')
				break
	if flag == 0:
		print('NO')


ch1 = input()
ch2 = input()
sw = 0
f1 = ''
f2 = ''
t1 = ''
t2 = ''
if len(ch1) == len(ch2):
	for i in range(len(ch1)):
		if ch1[i] != ch2[i]:
			sw += 1
			if sw > 2:
				break
			elif sw == 1:
				f1 = ch1[i]
				t1 = ch2[i]
			else:
				f2 = ch1[i]
				t2 = ch2[i]
if sw != 2 or f1 != t2 or f2 != t1:
	print('NO')
else:
	print('YES')


(a, b) = (input(), input())
if len(a) != len(b):
	print('NO')
else:
	c = []
	for i in range(len(a)):
		if a[i] != b[i]:
			c.append(i)
		if len(c) > 2:
			break
	if len(c) == 2:
		s = a[:c[0]] + a[c[1]] + a[c[0] + 1:]
		s = s[:c[1]] + a[c[0]] + a[c[1] + 1:]
		if s == b:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


a = input()
b = input()
l = len(a)
k = len(b)
i = 0
h1 = 0
h2 = 0
f = []
cnt = 0
a1 = list(a)
b1 = list(b)
if l == k:
	while i < l:
		y = a[i]
		z = b[i]
		if y != z:
			cnt += 1
			f.append(i)
		else:
			pass
		if cnt > 2:
			break
		i += 1
else:
	pass
if cnt == 2:
	h1 = f[0]
	h2 = f[1]
	b1 = list(b)
	(b1[h2], b1[h1]) = (b1[h1], b1[h2])
	tui = ''.join(b1)
	if l == k:
		if cnt == 2:
			if a == tui:
				print('YES')
			elif a != tui:
				print('NO')
	elif l != k:
		print('NO')
else:
	print('NO')


l = list(input())
d = list(input())
(n, m) = (len(l), len(d))
(ll, dd) = (sorted(l), sorted(d))
if n != m:
	print('NO')
elif ll != dd:
	print('NO')
else:
	c = 0
	for i in range(n):
		if l[i] != d[i]:
			c = c + 1
	if c > 2 or c == 1:
		print('NO')
	else:
		print('YES')


s = list(input())
l = list(input())
if len(s) != len(l):
	print('NO')
else:
	i = 0
	count = 0
	pos = []
	flag = 0
	for j in s:
		if j == l[i]:
			i += 1
			continue
		pos.append(i)
		if len(pos) > 2:
			flag = 1
			break
		i += 1
	if flag == 1:
		print('NO')
	elif len(pos) == 1:
		print('NO')
	else:
		i = pos[0]
		j = pos[1]
		a = s[i]
		b = s[j]
		c = l[i]
		d = l[j]
		if a != d or b != c:
			print('NO')
		else:
			print('YES')


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
n = list(input())
n1 = sorted(n)
m = list(input())
m1 = sorted(m)
a = []
b = []
count = 0
if n1 != m1 or len(n) != len(m):
	print('NO')
else:
	for i in range(len(n)):
		if n[i] != m[i]:
			count += 1
			a.append(n[i])
			b.append(m[i])
	if count == 2 and a[0] == b[1] and (a[1] == b[0]):
		print('YES')
	else:
		print('NO')


g1 = input()
g2 = input()
if len(g1) != len(g2):
	print('NO')
else:
	l1 = []
	l2 = []
	for i in range(len(g1)):
		if g1[i] != g2[i]:
			l1.append(g1[i])
			l2.append(g2[i])
	if len(l1) > 2:
		print('NO')
	else:
		l2.reverse()
		if l1 == l2:
			print('YES')
		else:
			print('NO')


s1 = input()
s2 = input()
d = list(s1)
d2 = list(s2)
d.sort()
d2.sort()
if len(s1) != len(s2):
	print('NO')
elif d == d2:
	c = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			c += 1
	if c > 2 or c == 1:
		print('NO')
	else:
		print('YES')
else:
	print('NO')


n = list(input())
m = list(input())
indp = None
indn = None
if len(n) == len(m):
	for i in range(len(n)):
		if n[i] != m[i]:
			if indp == None:
				indp = i
			else:
				indn = i
				(n[indp], n[i]) = (n[i], n[indp])
				if ''.join(n) == ''.join(m):
					print('YES')
				else:
					print('NO')
				break
	if indn == None and indp is not None:
		print('NO')
	if indp == None:
		print('YES')
else:
	print('NO')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
else:
	count = 0
	idx = []
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			count += 1
			idx.append(i)
	if count > 2:
		print('NO')
	elif count == 1:
		print('NO')
	else:
		l1 = list(s1)
		temp = s1[idx[0]]
		l1[idx[0]] = l1[idx[1]]
		l1[idx[1]] = temp
		s1 = ''
		for i in l1:
			s1 = s1 + i
		if s1 == s2:
			print('YES')
		else:
			print('NO')


x = input()
y = input()
if sorted(x) != sorted(y):
	print('NO')
else:
	s = 0
	for i in range(len(x)):
		if x[i] != y[i]:
			s += 1
	if s == 2:
		print('YES')
	else:
		print('NO')


import sys
first = list(str(input()))
second = list(str(input()))
if len(first) != len(second):
	print('NO')
	sys.exit()
settedf = set(first)
for i in settedf:
	if first.count(i) == second.count(i):
		pass
	else:
		print('NO')
		sys.exit()
c = 0
for (i, j) in zip(first, second):
	if i != j:
		c += 1
		if c >= 3:
			print('NO')
			sys.exit()
print('YES')


s = input()
t = input()
ss = set()
c = 0
if len(s) != len(t):
	print('NO')
else:
	for i in range(len(s)):
		if s[i] != t[i]:
			c += 1
			ss.add(s[i])
			ss.add(t[i])
	if c != 2:
		print('NO')
	elif len(ss) == 2:
		print('YES')
	else:
		print('NO')


l = []
s = input()
t = input()
c = 0
if len(t) == len(s):
	for i in range(len(t)):
		if t[i] != s[i]:
			l.append((t[i], s[i]))
			c += 1
		if c > 2:
			break
	if c > 2 or c == 1:
		print('NO')
	elif l[0][0] == l[1][1] and l[1][0] == l[0][1]:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


str1 = input()
str2 = input()
if len(str1) != len(str2):
	print('NO')
else:
	count = 0
	swap1 = 0
	swap2 = 0
	for index in range(0, len(str1)):
		if str1[index] != str2[index]:
			if count == 0:
				swap1 = index
				count += 1
			elif count == 1:
				swap2 = index
				count += 1
			else:
				count += 1
	if count == 2:
		strlst = list(str2)
		(strlst[swap1], strlst[swap2]) = (strlst[swap2], strlst[swap1])
		str2 = ''.join(strlst)
		if str1 == str2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


s1 = input()
s2 = input()
count = 0
x = []
for i in range(min(len(s1), len(s2))):
	if s1[i] != s2[i]:
		x.append(i)
		count = count + 1
	if count >= 3:
		break
if count == 2:
	s1 = list(s1)
	temp = s1[x[0]]
	s1[x[0]] = s1[x[1]]
	s1[x[1]] = temp
	s1 = ''.join(s1)
print('YES') if s1 == s2 else print('NO')


from sys import stdin, stdout
first = stdin.readline().strip()
second = stdin.readline().strip()
cnt = 0
if len(first) != len(second):
	stdout.write('NO')
else:
	(f, s) = ('', '')
	for i in range(len(first)):
		if first[i] != second[i]:
			cnt += 1
			f += first[i]
			s += second[i]
	if cnt == 1 or cnt > 2:
		stdout.write('NO')
	elif cnt == 2 and (f[0] != s[1] or f[1] != s[0]):
		stdout.write('NO')
	elif not cnt and len(set(list(first))) == len(first):
		stdout.write('NO')
	else:
		stdout.write('YES')


a = list(input())
b = list(input())
k = 0
if len(a) != len(b):
	print('NO')
else:
	c = []
	d = []
	for i in range(len(a)):
		if a[i] != b[i]:
			c.append(a[i])
			d.append(b[i])
		if len(c) > 2:
			print('NO')
			exit(0)
	c.sort()
	d.sort()
	if len(c) == 2 and c == d:
		print('YES')
	else:
		print('NO')


(s1, s2) = (input(), input())

def fn(s1, s2):
	if sorted(s1) == sorted(s2):
		count = 0
		for i in range(len(s1)):
			if s1[i] != s2[i]:
				count += 1
			if count > 2:
				return 'NO'
		if count == 2:
			return 'YES'
		else:
			return 'NO'
	else:
		return 'NO'
print(fn(s1, s2))


s1 = input()
s2 = input()
n = len(s1)
if len(s1) != len(s2):
	print('NO')
else:
	i = 0
	IndexList = []
	while i < n:
		if s1[i] != s2[i]:
			IndexList.append(i)
		i += 1
	if len(IndexList) == 2:
		if s1[IndexList[0]] == s2[IndexList[1]] and s1[IndexList[1]] == s2[IndexList[0]]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import collections
s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
	exit()
elif s1 == s2:
	print('YES')
	exit()
else:
	A = []
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			A.append(i)
	if len(A) != 2:
		print('NO')
	elif s1[A[1]] == s2[A[0]] and s1[A[0]] == s2[A[1]]:
		print('YES')
	else:
		print('NO')


def check(genomeA, genomeB):
	n = len(genomeA)
	m = len(genomeB)
	index = list()
	if n != m:
		return 'NO'
	result = 'YES'
	count = 0
	if genomeA == genomeB:
		return result
	else:
		for i in range(n):
			if genomeA[i] != genomeB[i]:
				count += 1
				index.append(i)
			if count == 3 and n > 2:
				result = 'NO'
				break
		if n > 2 and count == 1:
			result = 'NO'
		if n <= 2 and count != 2:
			result = 'NO'
		if result == 'YES':
			first = index[0]
			second = index[1]
			temp = genomeA[:first] + genomeA[second] + genomeA[first + 1:second] + genomeA[first] + genomeA[second + 1:]
			if temp != genomeB:
				result = 'NO'
		return result
genomeA = input().rstrip()
genomeB = input().rstrip()
print(check(genomeA, genomeB))


s = input()
t = input()
snot = set()
if len(s) != len(t):
	print('NO')
else:
	n = len(s)
	i = 0
	changes = 0
	while i < n:
		if s[i] != t[i]:
			changes += 1
			snot.add(s[i])
			snot.add(t[i])
		i += 1
	if changes == 2 and len(snot) == 2:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
s1 = [i for i in s1]
s2 = [i for i in s2]
match = []
if len(s1) == len(s2):
	for (i, j) in zip(s1, s2):
		match.append(int(i == j))
	c = match.count(0)
	if c == 0:
		print('YES')
	elif c != 2:
		print('NO')
	elif c == 2:
		mismatch = [idx for idx in range(len(match)) if match[idx] == 0]
		chars = set(s1[mismatch[0]] + s1[mismatch[1]] + s2[mismatch[0]] + s2[mismatch[1]])
		if len(chars) == 2:
			print('YES')
		else:
			print('NO')
else:
	print('NO')


a = input()
b = input()
x = [0] * 26
y = [0] * 26
n = len(a)
m = len(b)
c = 0
if n == m:
	for i in range(n):
		x[ord(a[i]) - 97] += 1
		y[ord(b[i]) - 97] += 1
	if x == y:
		for i in range(n):
			if a[i] != b[i]:
				c += 1
			if c > 2:
				print('NO')
				break
		if c == 2 or (c == 0 and len(a) != len(set(a))):
			print('YES')
		elif c < 2:
			print('NO')
	else:
		print('NO')
else:
	print('NO')


a = list(input())
b = list(input())
s = set(a)
c = 0
if len(a) == len(b):
	for i in s:
		if a.count(i) == b.count(i):
			c += 1
	if c == len(s):
		c2 = 0
		for j in range(len(a)):
			if a[j] == b[j]:
				continue
			elif c2 < 1:
				ch = a[j]
				sw = j
				c2 += 1
			elif c2 == 1:
				a[sw] = a[j]
				a[j] = ch
				if a == b:
					print('YES')
					break
				else:
					print('NO')
					break
			else:
				print('NO')
				break
	else:
		print('NO')
else:
	print('NO')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
	exit(0)
count = 0
for i in range(0, len(a)):
	if a[i] != b[i]:
		count += 1
		if count == 1:
			l = a[i]
			n = b[i]
		if count == 2:
			m = a[i]
			o = b[i]
		if count > 2:
			print('NO')
			exit(0)
if count == 2 and l == o and (n == m):
	print('YES')
else:
	print('NO')


(a, b, k) = (input(), input(), 0)
if len(a) != len(b):
	k = 1
else:
	p = []
	for i in range(len(a)):
		if a[i] != b[i]:
			if p:
				if not k:
					k = 1
					break
				elif p == ord(b[i]) - ord(a[i]):
					k = 0
				else:
					break
			else:
				p = ord(a[i]) - ord(b[i])
				k = 1
print('YNEOS'[k::2])


a = str(input())
b = str(input())
if len(a) != len(b):
	print('NO')
	exit()
(diff, c) = (0, [])
for i in range(len(a)):
	if a[i] != b[i]:
		diff += 1
	if diff > 2:
		print('NO')
		exit()
a = sorted(a)
b = sorted(b)
if a == b:
	print('YES')
else:
	print('NO')


def readln():
	return tuple(map(int, input().split()))
a = input()
b = input()
if len(a) != len(b):
	print('NO')
else:
	ind = [i for i in range(len(a)) if a[i] != b[i]]
	print('YES' if len(ind) == 2 and a[ind[0]] == b[ind[1]] and (a[ind[1]] == b[ind[0]]) else 'NO')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
else:
	l = [i for (x, y, i) in zip(a, b, range(len(a))) if x != y]
	if len(l) != 2:
		print('NO')
	else:
		print('YES' if a[l[0]] == b[l[1]] and a[l[1]] == b[l[0]] else 'NO')


a = str(input())
b = str(input())
c = len(a)
d = len(b)
e = 0
if c != d:
	print('NO')
	exit()
if a == b:
	if c > 26:
		print('YES')
		exit()
	for i in range(c):
		for j in range(c):
			if a[i] == b[j] and i != j:
				print('YES')
				exit()
	print('NO')
	exit()
for i in range(c):
	if a[i] != b[i]:
		e = e + 1
if e != 2:
	print('NO')
	exit()
for i in range(c):
	if a[i] != b[i]:
		f = a[i]
		g = b[i]
for i in range(c - 1, -1, -1):
	if a[i] != b[i]:
		h = a[i]
		m = b[i]
if f == m and g == h:
	print('YES')
else:
	print('NO')


def program():
	s = 0
	A = list(input())
	B = list(input())
	for (i, j) in zip(A, B):
		if i != j:
			s += 1
	A.sort()
	B.sort()
	if A == B and s == 2:
		print('YES')
	else:
		print('NO')
program()


(s, t) = (input(), input())
print('NYOE S'[sum((x != y for (x, y) in zip(s, t))) == 2 and all((y in s for y in t))::2])


a = list(input())
b = list(input())
if a == b:
	s = set(a)
	if len(s) == len(a):
		print('NO')
	else:
		print('YES')
	exit(0)
if len(a) != len(b):
	print('NO')
	exit(0)
j = 0
k = 0
ch1 = []
ch2 = []
for i in range(len(a)):
	if a[i] != b[i]:
		ch1.insert(j, b[i])
		j += 1
		ch2.insert(k, a[i])
		k += 1
if len(ch1) != 2:
	print('NO')
elif ch1[1] == ch2[0] and ch1[0] == ch2[1]:
	print('YES')
else:
	print('NO')


x = input()
y = input()
if len(x) != len(y):
	print('NO')
else:
	a = list(x)
	b = list(y)
	l = []
	for i in range(len(x)):
		if a[i] != b[i]:
			l.append((i, a[i]))
	if len(l) != 2:
		print('NO')
	else:
		a[l[0][0]] = l[1][1]
		a[l[1][0]] = l[0][1]
		if a == b:
			print('YES')
		else:
			print('NO')


(s, t) = (input(), input())
if len(s) != len(t):
	print('NO')
	exit(0)
l = []
count = int(0)
for i in range(0, len(s)):
	if s[i] != t[i]:
		count += 1
		l.append(i)
if count == 2 and s[l[0]] == t[l[1]] and (sorted(s) == sorted(t)):
	print('YES')
else:
	print('NO')


genome_1 = input()
genome_2 = input()
wrong_genes = []
if len(genome_2) == len(genome_1):
	for i in range(len(genome_1)):
		if genome_1[i] != genome_2[i]:
			wrong_genes.append([genome_1[i], genome_2[i]])
			if len(wrong_genes) == 3:
				break
print('YES' if len(wrong_genes) == 2 and wrong_genes[0][0] == wrong_genes[1][1] and (wrong_genes[0][1] == wrong_genes[1][0]) else 'NO')


a = input()
b = input()
(d, flag) = (0, 0)
temp = 0
result = a == b
if len(a) != len(b):
	print('NO')
else:
	for i in range(min(len(a), len(b))):
		if a[i] != b[i]:
			if d == 0 and flag == 0:
				d += 1
				temp = i
				flag = 1
			elif d == 1:
				if b[i] == a[temp] and b[temp] == a[i]:
					result = True
				else:
					d += 1
			else:
				break
	if d > 1:
		result = False
	print('NYOE S'[result::2])


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
from itertools import permutations
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def valid(row, col, rows, cols, rcross, lcross):
	return rows[row] == 0 and cols[col] == 0 and (rcross[col + row] == 0) and (lcross[col - row] == 0)

def div(n):
	tmp = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			cnt = 0
			while n % i == 0:
				n = n // i
				cnt += 1
			tmp.append((i, cnt))
	if n > 1:
		tmp.append((n, 1))
	return tmp

def isPrime(n):
	if n <= 1:
		return False
	elif n <= 2:
		return True
	else:
		flag = True
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				flag = False
				break
		return flag

def s(b):
	ans = []
	while b > 0:
		tmp = b % 10
		ans.append(tmp)
		b = b // 10
	return ans

def main():
	a = I().strip()
	b = I().strip()
	cnt = 0
	if len(a) != len(b):
		print('NO')
	else:
		pos1 = 0
		pos2 = 0
		for i in range(len(a)):
			if a[i] != b[i]:
				cnt += 1
				if cnt == 1:
					pos1 = i
				else:
					pos2 = i
		if cnt == 2 and a[pos1] == b[pos2] and (a[pos2] == b[pos1]):
			print('YES')
		else:
			print('NO')
main()


s1 = input()
s2 = input()
s = set()
count = 0
if len(s1) != len(s2):
	print('NO')
else:
	for i in range(0, len(s1)):
		if s1[i] != s2[i]:
			count += 1
			s.add(s1[i])
			s.add(s2[i])
	if count == 2 and len(s) == 2:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	s1 = input()
	s2 = input()
	lis = []
	st = []
	if len(s1) != len(s2):
		print('NO')
	else:
		for i in range(len(s1)):
			if s1[i] != s2[i]:
				lis.append(i)
				st.append(s1[i])
				st.append(s2[i])
		st = list(set(st))
		if len(lis) == 2 and len(st) == 2:
			print('YES')
		else:
			print('NO')
main()


S1 = list(input())
S2 = list(input())
if len(S1) != len(S2):
	print('NO')
else:
	wrong = 0
	for i in range(len(S1)):
		if S1[i] != S2[i]:
			wrong += 1
	S1.sort()
	S2.sort()
	if S1 == S2 and (wrong == 0 or wrong == 2):
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
r = 0
(t1, t2) = ('', '')
if len(s1) == len(s2):
	for i in range(len(s1)):
		if r > 2:
			print('NO')
			exit(0)
		if s1[i] != s2[i]:
			r += 1
			t1 += s1[i]
			t2 += s2[i]
	if ''.join(sorted(list(t1))) == ''.join(sorted(list(t2))):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


from collections import Counter
a = list(input())
b = list(input())
i = 0
p = []
if Counter(a) != Counter(b):
	print('NO')
else:
	c = 0
	p = []
	for i in range(len(a)):
		if a[i] != b[i]:
			c += 1
			p.append(i)
		if c > 2:
			print('NO')
			exit()
	(a[p[0]], a[p[1]]) = (a[p[1]], a[p[0]])
	if a == b:
		print('YES')
	else:
		print('NO')


t = input()
n = input()
a = []
b = []
f = 0
if len(t) == len(n):
	for x in range(0, len(t)):
		if t[x] == n[x]:
			pass
		else:
			a.append(t[x])
			b.append(n[x])
			if len(a) > 2 or len(b) > 2:
				print('NO')
				f = 1
				break
	a.sort()
	b.sort()
	if f == 0:
		if a[0] == b[0] and a[1] == b[1]:
			print('YES')
		else:
			print('NO')
else:
	print('NO')


a = input()
b = input()
cnt = [0] * 26
cnt2 = [0] * 26
for i in a:
	cnt[ord(i) - ord('a')] += 1
for i in b:
	cnt2[ord(i) - ord('a')] += 1
for i in range(len(cnt)):
	if cnt[i] != cnt2[i]:
		print('NO')
		exit(0)
tot = 0
for i in range(len(a)):
	if a[i] == b[i]:
		tot += 1
if len(a) - tot <= 2:
	print('YES')
else:
	print('NO')


import sys
(s1, s2) = sys.stdin.read().split()

def no():
	print('NO')
	exit(0)
if len(s1) != len(s2):
	no()
mismatch = -1
for i in range(len(s1)):
	if s1[i] != s2[i]:
		if mismatch == -1:
			mismatch = i
		elif mismatch != -2:
			if s1[mismatch] == s2[i] and s1[i] == s2[mismatch]:
				mismatch = -2
			else:
				no()
		else:
			no()
if mismatch != -2:
	no()
print('YES')


a = input()
b = input()
if len(a) != len(b) or len(a) == 1:
	print('NO')
elif a == b:
	print('YES')
else:
	s = [a[i] + b[i] for i in range(len(a)) if a[i] != b[i]]
	if len(s) == 2 and s[0] == s[1][::-1]:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
else:
	lens1 = len(s1)
	s = []
	ans = 0
	for i in range(lens1):
		if s1[i] != s2[i]:
			ans += 1
			s.append(list((s1[i], s2[i])))
	if ans != 2:
		print('NO')
	elif s[0][1] == s[1][0] and s[0][0] == s[1][1]:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
if not len(s1) == len(s2):
	print('NO')
	exit()
i = 0
j = len(s1) - 1
while i < j + 1 and s1[i] == s2[i]:
	i += 1
while j >= 0 and s1[j] == s2[j]:
	j -= 1
s1 = list(s1)
(s1[i], s1[j]) = (s1[j], s1[i])
if s1 == list(s2):
	print('YES')
else:
	print('NO')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
genome_1 = input()
genome_2 = input()
freq_1 = [0] * 26
freq_2 = [0] * 26
for c in genome_1:
	key = ord(c) - ord('a')
	freq_1[key] += 1
for c in genome_2:
	key = ord(c) - ord('a')
	freq_2[key] += 1
possible = True
count = 0
if len(genome_1) != len(genome_2):
	possible = False
for i in range(26):
	if freq_1[i] != freq_2[i]:
		possible = False
		break
swaps = 0
if possible:
	for i in range(len(genome_1)):
		if genome_1[i] != genome_2[i]:
			swaps += 1
		if swaps > 2:
			possible = False
	if swaps == 1:
		possible = False
if possible:
	print('YES')
else:
	print('NO')


(S1, S2, Dif) = (input(), input(), [])
if len(S1) != len(S2):
	print('NO')
	exit()
for i in zip(S1, S2):
	if i[0] != i[1]:
		Dif.append(sorted(i))
print('YES' if len(Dif) == 2 and Dif[0] == Dif[1] else 'NO')


a = str(input())
b = str(input())
if len(a) == len(b):
	num = 0
	candi = list()
	for (i, j) in zip(a, b):
		if i != j:
			num += 1
			candi.append((i, j))
	if num == 2 and candi[0][0] == candi[1][1] and (candi[1][0] == candi[0][1]):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def main():
	import collections
	from sys import stdin, stdout
	a = stdin.readline().strip()
	b = stdin.readline().strip()
	(ac, bc) = (collections.Counter(a), collections.Counter(b))
	if len(a) != len(b):
		stdout.write('NO\n')
	else:
		diff = 0
		for i in range(len(a)):
			diff += a[i] != b[i]
		if ac == bc and diff == 2:
			stdout.write('YES\n')
		else:
			stdout.write('NO\n')
main()


s = input()
z = input()
l = 0
p = 0
if len(s) != len(z):
	print('NO')
else:
	for n in s:
		if n in z:
			p = 0
		else:
			p = 1
			print('NO')
			break
	if p == 0:
		for k in z:
			if k in s:
				p = 0
			else:
				p = 1
				print('NO')
				break
	if p == 0:
		for n in range(len(s)):
			if s[n] != z[n]:
				l += 1
			if l == 3:
				print('NO')
				p = 1
				break
		if p == 0:
			if l == 2:
				print('YES')
			else:
				print('NO')


s1 = input()
s2 = input()
f = 0
l1 = len(s1)
l2 = len(s2)
if l1 == l2:
	idx = []
	s = 0
	for i in range(l1):
		if s1[i] != s2[i]:
			idx.append(i)
			s += 1
	if s == 0:
		print('YES')
	elif s > 2 or s == 1:
		print('NO')
	else:
		(si, ei) = idx
		s3 = s1[:si] + s1[ei] + s1[si + 1:ei] + s1[si] + s1[ei + 1:]
		if s3 == s2:
			print('YES')
		else:
			print('NO')
else:
	print('NO')


from collections import Counter

def go():
	a = [i for i in input()]
	b = [i for i in input()]
	a_c = Counter(a)
	b_c = Counter(b)
	if len(a) != len(b) or a_c != b_c:
		return 'NO'
	differences = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			differences += 1
	if differences == 2:
		return 'YES'
	return 'NO'
print(go())


g1 = input()
g2 = input()
first = -1
second = -1
count = 0
done = False
if len(g1) != len(g2):
	print('NO')
	done = True
if not done:
	for (i, _) in enumerate(g1):
		if g1[i] != g2[i]:
			count += 1
			if count > 2:
				print('NO')
				done = True
				break
			if first < 0:
				first = i
			else:
				second = i
if not done and count == 1:
	print('NO')
	done = True
elif not done and count == 0:
	print('YES')
	done = True
if not done:
	if g1[first] == g2[second] and g2[first] == g1[second]:
		print('YES')
	else:
		print('NO')


from functools import reduce
from collections import Counter
import time
import datetime

def time_t():
	print('Current date and time: ', datetime.datetime.now())
	print('Current year: ', datetime.date.today().strftime('%Y'))
	print('Month of year: ', datetime.date.today().strftime('%B'))
	print('Week number of the year: ', datetime.date.today().strftime('%W'))
	print('Weekday of the week: ', datetime.date.today().strftime('%w'))
	print('Day of year: ', datetime.date.today().strftime('%j'))
	print('Day of the month : ', datetime.date.today().strftime('%d'))
	print('Day of week: ', datetime.date.today().strftime('%A'))

def ip():
	return int(input())

def sip():
	return input()

def mip():
	return map(int, input().split())

def mips():
	return map(str, input().split())

def lip():
	return list(map(int, input().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)
a = sip()
b = sip()
flag = 0
lst = []
if len(a) == len(b):
	for i in range(len(a)):
		if a[i] != b[i]:
			lst.append(i)
	if len(lst) != 2:
		print('NO')
	else:
		a = list(a)
		b = list(b)
		(a[lst[0]], a[lst[1]]) = (a[lst[1]], a[lst[0]])
		for i in range(len(a)):
			if a[i] != b[i]:
				flag = 1
		if flag == 1:
			print('NO')
		else:
			print('YES')
else:
	print('NO')


s1 = input()
s2 = input()
count = 0
if len(s1) == len(s2):
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			count += 1
	if (count == 2 or count == 0) and sorted(s1) == sorted(s2):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


a = input()
b = input()
if sorted(a) != sorted(b):
	print('NO')
else:
	x = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			x += 1
	if x == 2:
		print('YES')
	else:
		print('NO')


g1 = input()
g2 = input()
if len(g2) != len(g1):
	print('NO')
	exit()
dif = 0
j = k = -1
for i in range(len(g1)):
	if g1[i] != g2[i]:
		dif += 1
		if j > -1:
			k = i
		else:
			j = i
	if dif > 2:
		break
if dif != 2:
	print('NO')
elif g1[k] == g2[j] and g1[j] == g2[k]:
	print('YES')
else:
	print('NO')


import collections
a = input()
b = input()
if len(a) != len(b):
	print('NO')
else:
	d1 = collections.Counter(a)
	d2 = collections.Counter(b)
	if d1 != d2:
		print('NO')
	else:
		c = 0
		for i in range(0, len(a)):
			if a[i] != b[i]:
				c += 1
		if c == 2:
			print('YES')
		else:
			print('NO')


s1 = input()
s2 = input()
i1 = -1
b = False
if len(s1) == len(s2):
	for i in range(len(s1)):
		if s1[i] == s2[i]:
			continue
		if i1 == -1:
			i1 = i
		elif s1[i1] == s2[i] and s1[i] == s2[i1] and (s1[i + 1:] == s2[i + 1:]):
			b = True
			break
		else:
			break
if b:
	print('YES')
else:
	print('NO')


a = input()
b = input()
char_a = {}
char_b = {}
if len(a) == len(b):
	for i in range(len(a)):
		if a[i] in char_a:
			char_a[a[i]] += 1
		else:
			char_a[a[i]] = 1
		if b[i] in char_b:
			char_b[b[i]] += 1
		else:
			char_b[b[i]] = 1
	for k in char_a.keys():
		if k in char_b:
			if char_a[k] == char_b[k]:
				char_b.pop(k)
			else:
				print('NO')
				exit()
		else:
			print('NO')
			exit()
	if char_b:
		print('NO')
		exit()
	else:
		mismatch = 0
		for i in range(len(a)):
			if a[i] != b[i]:
				mismatch += 1
			if mismatch > 2:
				print('NO')
				exit()
		if mismatch > 2:
			print('NO')
		else:
			print('YES')
else:
	print('NO')


a = input()
b = input()
c = 0
if sorted(a) == sorted(b):
	for (i, j) in zip(a, b):
		if i != j:
			c = c + 1
		if c > 2:
			print('NO')
			exit()
	if c == 2:
		print('YES')
else:
	print('NO')


z = list(input())
x = list(input())
c = 0
a = 0
if len(x) != len(z):
	print('NO')
elif sorted(z) == sorted(x):
	for i in z:
		if x[c] != i:
			a += 1
			if a > 2:
				break
		c += 1
	if a == 2:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


get_int = lambda : int(input())
get_mul_int = lambda : map(int, input().rstrip().split())
get_list = lambda : list(map(int, input().rstrip().split()))
TEST_CASES = False

def main():
	a = input()
	b = input()
	n = len(a)
	c = 0
	s1 = s2 = []
	if len(a) != len(b):
		print('NO')
		return
	else:
		for i in range(n):
			if a[i] != b[i]:
				s1.append(a[i])
				s2.append(b[i])
				c += 1
		if c == 2 and s1 == s2[::-1]:
			print('YES')
		else:
			print('NO')
if not TEST_CASES:
	main()
else:
	[main() for _ in range(int(input()))]


def check(a, i, j, b):
	t = a[j]
	a[j] = a[i]
	a[i] = t
	is_ok = False
	if a == b:
		is_ok = True
	t = a[j]
	a[j] = a[i]
	a[i] = t
	return is_ok

def main():
	a = [v for v in input()]
	b = [v for v in input()]
	if len(a) != len(b):
		print('NO')
		return
	pos = []
	for i in range(0, len(a)):
		if a[i] != b[i]:
			pos.append(i)
	if len(pos) != 2:
		print('NO')
		return
	if check(a, pos[0], pos[1], b):
		print('YES')
		return
	print('NO')
main()


s1 = input()
s2 = input()
n1 = len(s1)
n2 = len(s2)
a = [0] * 26
b = [0] * 26
k = 0
for i in range(n1):
	a[ord(s1[i]) - 97] += 1
for i in range(n2):
	b[ord(s2[i]) - 97] += 1
for i in range(26):
	if a[i] != b[i]:
		print('NO')
		k = 1
		break
if k != 1:
	if n1 != n2:
		print('NO')
	else:
		c = 0
		for i in range(n1):
			if s1[i] != s2[i]:
				c += 1
		if c == 2:
			print('YES')
		else:
			print('NO')


f = lambda : list(map(ord, list(input())))
(genome_1, genome_2) = (f(), f())
n = len(genome_1)
m = len(genome_2)
if n != m or n < 1 or m < 1:
	print('NO')
	exit()
d = []
for i in range(n):
	if genome_1[i] ^ genome_2[i] != 0:
		d.append(i)
	if len(d) > 2:
		break
if len(d) != 2:
	print('NO')
	exit()
genome_1[d[0]] ^= genome_1[d[1]]
genome_1[d[1]] ^= genome_1[d[0]]
genome_1[d[0]] ^= genome_1[d[1]]
if genome_1 == genome_2:
	print('YES')
else:
	print('NO')


s1 = input()
s2 = input()
cnt = 0
n = min(len(s1), len(s2))
for i in range(n):
	if s1[i] != s2[i]:
		cnt += 1
if cnt == 2 and set(s1) == set(s2):
	print('YES')
else:
	print('NO')


def solution():
	a = input()
	b = input()
	ca = [0] * 26
	cb = [0] * 26
	for i in a:
		ca[ord(i) - ord('a')] += 1
	for i in b:
		cb[ord(i) - ord('a')] += 1
	if ca != cb:
		print('NO')
		return
	strike = 0
	n = len(a)
	for i in range(n):
		if a[i] != b[i]:
			if strike < 2:
				strike += 1
			else:
				print('NO')
				return
	print('YES')
	return
solution()


i = int
cin = input
le = len
s = str
a1 = cin()
a2 = cin()
if le(a1) != le(a2):
	print('NO')
else:
	if set(a1) != set(a2):
		print('NO')
		exit()
	cn = 0
	for (idx, char) in enumerate(a1):
		if cn > 2:
			print('NO')
			exit()
		if char != a2[idx]:
			cn += 1
	if cn == 1:
		print('NO')
	elif cn == 2:
		print('YES')


a = input()
b = input()
a.split()
a = list(a)
b.split()
b = list(b)
c1 = 0
c = []
if len(a) != len(b):
	print('NO')
else:
	for i in range(len(a)):
		if a[i] != b[i]:
			c1 += 1
			c.append(a[i])
			c.append(b[i])
	if c1 == 2:
		if c[0] == c[3] and c[1] == c[2]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
	quit()
(posx, posy) = (-1, -1)
for i in range(len(s1)):
	if s1[i] != s2[i]:
		if posx == -1:
			posx = i
		elif posx != -1 and posy == -1:
			posy = i
		else:
			print('NO')
			quit()
if posx != -1 and posy != -1 and (s1[posx] == s2[posy]) and (s1[posy] == s2[posx]):
	print('YES')
else:
	print('NO')


s = input()
t = input()
if len(s) != len(t):
	print('NO')
else:
	ch1 = ''
	ch2 = ''
	for i in range(len(s)):
		if s[i] != t[i]:
			ch1 += s[i]
			ch2 += t[i]
	if len(ch1) != 2 or len(ch2) != 2:
		print('NO')
	elif ch1 == ch2[::-1]:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
string1 = input()
string2 = input()
if len(string1) != len(string2):
	print('NO')
else:
	wrong = 0
	for i in range(len(string1)):
		if string1[i] != string2[i]:
			wrong += 1
	string1 = list(string1)
	string2 = list(string2)
	string1.sort()
	string2.sort()
	if string1 == string2 and (wrong == 0 or wrong == 2):
		print('YES')
	else:
		print('NO')


(a, b) = (input(), input())
if len(a) != len(b):
	print('NO')
	exit()
d = [i for i in range(len(a)) if a[i] != b[i]]
if len(d) != 2:
	print('NO')
elif a[d[0]] == b[d[1]] and a[d[1]] == b[d[0]]:
	print('YES')
else:
	print('NO')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
	exit()
else:
	c = 0
	k = []
	for i in range(len(a)):
		if a[i] != b[i]:
			c += 1
			k.append(a[i])
			k.append(b[i])
			if c > 2:
				print('NO')
				exit()
	if c == 2 and k.count(k[0]) == 2 and (k.count(k[1]) == 2):
		print('YES')
	else:
		print('NO')


g1 = input()
g2 = input()
if len(g1) == len(g2):
	k = 0
	for (i, j) in enumerate(g1):
		if g2[i] != j:
			k += 1
	gg1 = list(g1)
	gg2 = list(g2)
	gg1.sort()
	gg2.sort()
	if (k == 0 or k == 2) and gg1 == gg2:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


s = input()
r = input()
count = 0
if len(s) != len(r):
	print('NO')
elif len(set(s)) != len(set(r)):
	print('NO')
elif sorted(set(s)) != sorted(set(r)):
	print('NO')
else:
	n = min(len(s), len(r))
	for i in range(n):
		if s[i] != r[i]:
			count += 1
	if count == 2:
		print('YES')
	else:
		print('NO')


from itertools import permutations
s1 = input()
s2 = input()
d = 0
(ch1, ch2) = ('', '')
if len(s1) == len(s2):
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			if d == 1:
				if s1[i] != ch1 and s1[i] != ch2 or (s2[i] != ch1 and s2[i] != ch2):
					break
			(ch1, ch2) = (s1[i], s2[i])
			d += 1
			if d > 2:
				break
if d == 2:
	print('YES')
else:
	print('NO')


s1 = input()
s2 = input()
from collections import Counter
c1 = Counter(s1)
c2 = Counter(s2)
if c1 != c2:
	print('NO')
elif len(s1) != len(s2):
	print('NO')
else:
	c = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			c += 1
	print('YES' if c == 2 else 'NO')


(n, m) = (input(), input())
if len(n) != len(m):
	print('NO')
else:
	tes = 0
	q = 0
	w = 0
	for i in range(len(n)):
		if n[i] != m[i]:
			tes += 1
			if tes == 1:
				q = i
			elif tes == 2:
				w = i
	if tes != 2:
		print('NO')
	else:
		temp1 = n[q]
		temp2 = n[w]
		n = n[:q] + temp2 + n[q + 1:]
		n = n[0:w] + temp1 + n[w + 1:]
		if n == m:
			print('YES')
		else:
			print('NO')


import sys
s1 = list(input())
s2 = list(input())
(d1, d2) = (dict(), dict())
miss = 0
if len(s1) != len(s2):
	print('NO')
	sys.exit(0)
for i in range(97, 97 + 26):
	d1[chr(i)] = 0
	d2[chr(i)] = 0
for i in range(len(s1)):
	d1[s1[i]] += 1
	d2[s2[i]] += 1
	if s1[i] != s2[i]:
		miss += 1
if d1 == d2 and miss == 2:
	print('YES')
else:
	print('NO')


a = list(input())
b = list(input())
ans = 'NO'
if len(a) == len(b):
	l = []
	for i in range(len(a)):
		if a[i] != b[i]:
			l.append(i)
	if len(l) == 2:
		(a[l[0]], a[l[1]]) = (a[l[1]], a[l[0]])
		if a == b:
			ans = 'YES'
print(ans)


(s, s1) = (input(), input())
if len(s) != len(s1):
	print('NO')
elif set(s1) != set(s):
	print('NO')
else:
	cnt = 0
	for i in range(len(s)):
		if s[i] != s1[i]:
			cnt += 1
	if cnt == 2:
		print('YES')
	else:
		print('NO')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
else:
	c = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			c += 1
	if c not in [0, 2]:
		print('NO')
	elif set(a) == set(b):
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
d1 = {}
d2 = {}
count = 0
if len(s1) != len(s2):
	print('NO')
else:
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			count += 1
			if count == 1:
				start = i
			if count == 2:
				end = i
	if count == 2 and s1[start] == s2[end] and (s1[end] == s2[start]):
		print('YES')
	else:
		print('NO')


a = input()
b = input()
d = {}
count = cf = 0
con = 1
z = []
if len(a) == len(b):
	for x in range(len(a)):
		if a[x] != b[x]:
			z.append((a[x], b[x]))
			count += 1
		if count > 2:
			con = 0
			break
		if a[x] not in d:
			d[a[x]] = 1
		else:
			cf = 1
	if con:
		if count == 2 and z[0] == z[1][::-1]:
			print('YES')
		elif count == 0 and cf:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
else:
	print('NO')


arr = list(input())
arr2 = list(input())
arrp = []
if len(arr) == len(arr2):
	if arr == arr2:
		print('YES')
	else:
		for k in range(len(arr)):
			if arr[k] != arr2[k]:
				arrp.append(k)
		if len(arrp) == 2:
			(arr[arrp[0]], arr[arrp[1]]) = (arr[arrp[1]], arr[arrp[0]])
		elif len(arrp) == 0:
			print('YES')
			exit()
		else:
			print('NO')
			exit()
		if arr == arr2:
			print('YES')
		else:
			print('NO')
			exit()
else:
	print('NO')


def solve():
	s = input()
	t = input()
	if len(s) != len(t):
		print('NO')
		return
	r = []
	for i in range(len(s)):
		if s[i] != t[i]:
			r.append(i)
			if len(r) > 2:
				print('NO')
				return
	if len(r) == 1:
		print('NO')
		return
	elif len(r) == 2 and (s[r[0]] != t[r[1]] or s[r[1]] != t[r[0]]):
		print('NO')
		return
	print('YES')
solve()


first = input()
second = input()
if len(first) != len(second):
	print('NO')
else:
	sw = []
	count = 0
	i = 0
	while i < len(first) and count < 2:
		if first[i] != second[i]:
			sw.append(i)
			count += 1
		i += 1
	if count == 2:
		l1 = list(first)
		(l1[sw[0]], l1[sw[1]]) = (l1[sw[1]], l1[sw[0]])
		if second == ''.join(l1):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


string1 = input()
string2 = input()
if len(string1) != len(string2):
	print('NO')
else:
	count = 0
	varied = []
	for i in range(len(string1)):
		if string1[i] != string2[i]:
			count += 1
			varied.append((string1[i], string2[i]))
	if count == 0 or (count == 2 and varied[0][0] == varied[1][1] and (varied[1][0] == varied[0][1])):
		print('YES')
	else:
		print('NO')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
	exit(0)
s = 0
for i in range(len(a)):
	if a[i] != b[i]:
		s += 1
a = ''.join(sorted(a))
b = ''.join(sorted(b))
if s == 2 and a == b:
	print('YES')
else:
	print('NO')


string1 = str(input())
string2 = str(input())
if len(string1) != len(string2):
	print('NO')
	exit(0)
nr = 0
for i in range(len(string1)):
	if string1[i] != string2[i]:
		nr += 1
ok = False
string1 = ''.join(sorted(string1))
string2 = ''.join(sorted(string2))
if string2 == string1:
	ok = True
print('YES') if nr == 2 and ok == True else print('NO')


inp = input()
inp2 = input()
l1 = list(inp)
l2 = list(inp2)
f = []
s = []
if len(inp) != len(inp2):
	print('NO')
else:
	for i in range(len(l1)):
		if l1[i] == l2[i]:
			pass
		else:
			f.append(l1[i])
			s.append(l2[i])
	if len(f) > 2:
		print('NO')
	elif f[-1::-1] == s:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
	exit()
l = []
for i in range(len(s1)):
	if s1[i] != s2[i]:
		l.append(i)
if len(l) > 2 or len(l) == 1:
	print('NO')
elif len(l) == 0:
	print('YES')
else:
	res = [0] * len(s1)
	for i in range(len(s1)):
		if i == l[0]:
			res[i] = s1[l[1]]
		elif i == l[1]:
			res[i] = s1[l[0]]
		else:
			res[i] = s1[i]
	if ''.join(res) == s2:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
	exit()
l = []
for (i, (a, b)) in enumerate(zip(s1, s2)):
	if a != b:
		l.append(i)
if len(l) > 2 or len(l) == 1:
	print('NO')
elif len(l) == 0:
	print('YES')
else:
	print('YES ' if s1[l[0]] == s2[l[1]] and s1[l[1]] == s2[l[0]] else 'NO')


def solve():
	f = input()
	s = input()
	diff = []
	if len(f) != len(s):
		return 'NO'
	for (index, char) in enumerate(f):
		if char != s[index]:
			diff.append(index)
		if len(diff) > 2:
			return 'NO'
	if len(diff) == 1:
		return 'NO'
	l_idx = diff[0]
	r_idx = diff[1]
	if f[l_idx] == s[r_idx] and f[r_idx] == s[l_idx]:
		return 'YES'
	return 'NO'
print(solve())


a = input()
b = input()
count = 0
diff = 0
c = []
if len(a) == len(b):
	count += 1
for (i, j) in zip(a, b):
	if i != j:
		c.append(i)
		c.append(j)
		diff += 1
if diff == 2:
	count += 1
if len(set(c)) == 2:
	count += 1
if count == 3:
	print('YES')
else:
	print('NO')


first = input()
second = input()
s = 0
if len(first) != len(second):
	print('NO')
	exit()
i = 0
while i < len(first):
	if first[i] != second[i]:
		s += 1
	i += 1
if set(first) == set(second) and s == 2:
	print('YES')
else:
	print('NO')


fi = input()
se = input()
nfi = len(fi)
nse = len(se)
if nfi != nse:
	print('NO')
else:
	c = 0
	dic = {}
	for i in range(nfi):
		if fi[i] != se[i]:
			dic[fi[i]] = se[i]
			c += 1
			if c > 2:
				print('NO')
				break
	if c <= 2:
		if c == 0:
			print('YES')
		elif c == 1:
			print('NO')
		else:
			va = list(dic.values())
			ke = list(dic.keys())
			if sorted(va) == sorted(ke):
				print('YES')
			else:
				print('NO')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
else:
	c1 = ''
	c2 = ''
	count = 0
	l = []
	for i in range(len(s1)):
		if count > 2:
			break
		if s1[i] == s2[i]:
			continue
		else:
			count += 1
			l.append(i)
	if count != 2:
		print('NO')
	elif s1[l[0]] == s2[l[1]] and s1[l[1]] == s2[l[0]]:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
else:
	count = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			count += 1
	if count != 2:
		print('NO')
	else:
		l1 = list(s1)
		l2 = list(s2)
		l1.sort()
		l2.sort()
		if l1 == l2:
			print('YES')
		else:
			print('NO')


s1 = input()
s2 = input()
count = 0
for i in range(min(len(s1), len(s2))):
	if s1[i] != s2[i]:
		count += 1
if count == 2:
	if set(s1) == set(s2):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import sys
a = input()
b = input()
count = 0
if len(a) != len(b):
	print('NO')
	sys.exit()
elif set(a) == set(b):
	for x in range(len(a)):
		if a[x] != b[x]:
			count += 1
	if count <= 2:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


s1 = input()
s2 = input()
s1 = list(s1)
s2 = list(s2)
if len(s1) != len(s2):
	print('NO')
else:
	c = 0
	l = []
	l2 = []
	f = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			c += 1
			l.append(s1[i])
			l2.append(s2[i])
		if c > 2:
			f = 1
			print('NO')
			break
	if f == 0:
		l.sort()
		l2.sort()
		if l == l2:
			print('YES')
		else:
			print('NO')


a = input()
s = input()
c = 0
l = 0
if len(a) != len(s):
	print('NO')
else:
	for i in range(len(a)):
		if a[i] != s[i]:
			c += 1
			if c == 1:
				a1 = a[i]
				s1 = s[i]
			if c == 2:
				if a[i] != s1 or s[i] != a1:
					print('NO')
					c = 3
					l = 1
					break
	if c == 2 or c == 0:
		print('YES')
	elif l == 0:
		print('NO')


s = input()
t = input()
if len(s) != len(t):
	print('NO')
else:
	mistakes = []
	for i in range(len(s)):
		if s[i] != t[i]:
			mistakes.append(i)
	if len(mistakes) == 0:
		if len(set(s)) == len(s):
			print('NO')
		else:
			print('YES')
	elif len(mistakes) == 2:
		if s[mistakes[0]] == t[mistakes[1]] and s[mistakes[1]] == t[mistakes[0]]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


s = input()
t = input()
if len(s) == len(t):
	(a, b) = ('', '')
	for (i, j) in zip(s, t):
		if i != j:
			a += i
			b += j
	if len(a) == 2:
		if a[0] == b[1] and a[1] == b[0]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
else:
	print('NO')


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
import math
mod = 100000007

def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def main():
	s = list(si())
	t = list(si())
	if len(s) != len(t):
		print('NO')
		exit()
	c = 0
	for i in range(len(s)):
		if s[i] != t[i]:
			c += 1
	s.sort()
	t.sort()
	if c == 2 and s == t:
		print('YES')
	else:
		print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


s1 = input()
s2 = input()
l1 = sorted(list(s1))
l2 = sorted(list(s2))
count = 0
if len(s1) != len(s2):
	print('NO')
	exit()
if l1 != l2:
	print('NO')
	exit()
for i in range(len(s1)):
	if s1[i] != s2[i]:
		count += 1
	if count > 2:
		break
if count == 2:
	print('YES')
else:
	print('NO')


s1 = input()
s2 = input()
n1 = len(s1)
n2 = len(s2)
if n1 != n2:
	print('NO')
else:
	co = True
	count = 0
	A = []
	B = []
	for i in range(n1):
		if s1[i] != s2[i]:
			count += 1
			if count <= 2:
				A.append(s1[i])
				B.append(s2[i])
			else:
				co = False
				break
	if co and A[-1] == B[0] and (B[-1] == A[0]):
		print('YES')
	else:
		print('NO')


import collections
s1 = input()
s2 = input()
c1 = collections.Counter(s1)
c2 = collections.Counter(s2)
c = 0
s1 = list(s1)
s2 = list(s2)
if len(c1) == len(c2):
	for i in c1:
		if c1[i] != c2[i]:
			print('NO')
			break
	else:
		for i in range(len(s1)):
			if s1[i] != s2[i] and c <= 2:
				s1[i] = s2[i]
				c += 1
		s1 = ''.join(s1)
		s2 = ''.join(s2)
		if s1 == s2:
			print('YES')
		else:
			print('NO')
else:
	print('NO')


from collections import defaultdict
s = input().strip()
t = input().strip()
ls = len(s)
lt = len(t)
ms = None
mt = None
if ls != lt:
	print('NO')
else:
	miss = 0
	for i in range(ls):
		if s[i] != t[i]:
			miss += 1
			if not ms:
				ms = s[i]
				mt = t[i]
			elif ms and ms != t[i] or mt != s[i]:
				print('NO')
				break
	else:
		if miss != 2 or not miss:
			print('NO')
		else:
			print('YES')


a = input()
b = input()
diffs = []
if len(a) != len(b):
	print('NO')
else:
	for i in range(len(a)):
		if a[i] != b[i]:
			diffs.append(i)
	if len(diffs) != 2:
		print('NO')
	else:
		(p1, p2) = (diffs[0], diffs[1])
		if a[p1] == b[p2] and a[p2] == b[p1]:
			print('YES')
		else:
			print('NO')


import collections, math, itertools, bisect, heapq, copy

class Solution:

	def solve(self):
		str1 = input()
		str2 = input()
		if len(str1) != len(str2):
			print('NO')
			return
		d = []
		for i in range(len(str1)):
			if str1[i] != str2[i]:
				d.append(i)
		if len(d) != 2:
			print('NO')
		elif str1[d[1]] == str2[d[0]] and str1[d[0]] == str2[d[1]]:
			print('YES')
		else:
			print('NO')
solution = Solution()
solution.solve()


def main():
	(aa, bb, res) = (input(), input(), [])
	for (i, a, b) in zip(range(100000), aa, bb):
		if a != b:
			res.append(i)
			if len(res) > 2:
				break
	print(('NO', 'YES')[len(res) == 2 and aa[res[0]] == bb[res[1]] and (aa[res[1]] == bb[res[0]]) and (len(aa) == len(bb))])
main()


n = list(input())
m = list(input())
if sorted(n) != sorted(m):
	print('NO')
else:
	s = 0
	for i in range(len(n)):
		if n[i] != m[i]:
			s = s + 1
	if s == 2:
		print('YES')
	else:
		print('NO')


a = input()
b = input()
d = 0
f = []
if not len(a) == len(b):
	print('NO')
else:
	for i in range(len(a)):
		if not a[i] == b[i]:
			d += 1
			if d == 3:
				break
			f.append([a[i], b[i]])
	if d == 2:
		print('YES' if f[0][0] == f[1][1] and f[0][1] == f[1][0] else 'NO')
	else:
		print('NO')


def main():
	string1 = str(input())
	string2 = str(input())
	if len(string1) != len(string2):
		print('NO')
		return
	temp = -1
	flag = True
	for i in range(len(string1)):
		if string1[i] != string2[i]:
			if temp == -1:
				temp = i
				flag = False
			elif string1[temp] == string2[i] and string2[temp] == string1[i]:
				flag = True
			else:
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')
main()


s = input()
t = input()
k1 = []
k2 = []
if len(s) != len(t):
	print('NO')
	exit()
else:
	for i in range(len(s)):
		if s[i] == t[i]:
			continue
		else:
			k1.append(s[i])
			k2.append(t[i])
k1.sort()
k2.sort()
if k1 == k2 and len(k2) == 2:
	print('YES')
else:
	print('NO')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
else:
	swap = []
	count = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			count += 1
			swap.append(i)
	if count != 2:
		print('NO')
	else:
		a = list(a)
		(a[swap[0]], a[swap[1]]) = (a[swap[1]], a[swap[0]])
		a = ''.join(a)
		if a == b:
			print('YES')
		else:
			print('NO')


first = str(input())
second = str(input())
if len(first) != len(second):
	print('NO')
else:
	count = 0
	swap1 = 0
	swap2 = 0
	for i in range(len(first)):
		if first[i] != second[i]:
			if count == 0:
				swap1 = i
				count += 1
			elif count == 1:
				swap2 = i
				count += 1
			else:
				count += 1
	if count == 2:
		second_list = list(second)
		(second_list[swap1], second_list[swap2]) = (second_list[swap2], second_list[swap1])
		second = ''.join(second_list)
		if first == second:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


a1 = list(input())
a2 = list(input())
if len(a1) != len(a2):
	print('NO')
	quit()
first = 0
ss = 0
for i in range(len(a1)):
	if a1[i] != a2[i]:
		first = i
		break
for i in reversed(range(len(a1))):
	if a1[i] != a2[i]:
		ss = i
		break
temp = a1[first]
a1[first] = a1[ss]
a1[ss] = temp
if a1 == a2:
	print('YES')
else:
	print('NO')


c = [0] * 26
d = [0] * 26
a = input()
b = input()
for i in a:
	c[ord(i) - 97] = c[ord(i) - 97] + 1
for i in b:
	d[ord(i) - 97] = d[ord(i) - 97] + 1
z = 0
for j in range(0, 26):
	if c[j] == d[j]:
		z = z + 1
if z != 26:
	print('NO')
else:
	z = 0
	for j in range(0, len(a)):
		if a[j] != b[j]:
			z = z + 1
	if z == 2:
		print('YES')
	else:
		print('NO')


a = input().lower()
import sys
b = input().lower()
c = 0
h = []
n = []
k = 0
if len(a) != len(b):
	print('NO')
	sys.exit()
for i in range(len(a)):
	if a[i] != b[i]:
		c += 1
		if c > 2:
			k = 1
			break
		h.append(a[i])
		n.append(b[i])
h.sort()
n.sort()
if k == 1:
	print('NO')
elif h == n and c == 2:
	print('YES')
else:
	print('NO')


from collections import Counter
a = input()
b = input()
print('YNEOS'[Counter(a) != Counter(b) or sum((i != j for (i, j) in zip(a, b))) > 2::2])


import sys
real = sys.stdin.readline().strip()
img = sys.stdin.readline().strip()
index = []
count = 0
if len(real) != len(img):
	print('NO')
else:
	for i in range(len(real)):
		if count > 2:
			break
		if real[i] != img[i]:
			count += 1
			index.append(i)
	if count > 2 or count < 2:
		print('NO')
	elif real[index[0]] == img[index[1]] and real[index[1]] == img[index[0]]:
		print('YES')
	else:
		print('NO')


def solve(str1, str2):
	n1 = len(str1)
	n2 = len(str2)
	if n1 != n2:
		return 'NO'
	if str1 == str2:
		return 'YES'
	diff1 = None
	diff2 = None
	for i in range(n1):
		if str1[i] != str2[i]:
			if diff2:
				return 'NO'
			if diff1 == None:
				diff1 = i
			else:
				diff2 = i
	if diff2 == None:
		return 'NO'
	if str1[diff1] == str2[diff2] and str1[diff2] == str2[diff1]:
		return 'YES'
	return 'NO'
str1 = input()
str2 = input()
print(solve(str1, str2))


d1 = input()
d2 = input()
zipped = zip(d1, d2)
counter = 0
incorrect = []
if len(d1) != len(d2):
	print('NO')
	counter = 0
else:
	for (a, b) in zipped:
		if a != b:
			counter += 1
			incorrect.append((a, b))
		if counter > 2:
			print('NO')
			break
if counter == 2:
	if incorrect[0][0] == incorrect[1][1] and incorrect[0][1] == incorrect[1][0]:
		print('YES')
	else:
		print('NO')
elif len(d1) == len(d2) and counter < 2:
	print('NO')


s1 = input()
s2 = input()
h1 = [0 for i in range(26)]
h2 = [0 for i in range(26)]
for k in range(len(s1)):
	h1[ord(s1[k]) - ord('a')] += 1
for k in range(len(s2)):
	h2[ord(s2[k]) - ord('a')] += 1
res = True
for i in range(26):
	if h1[i] != h2[i]:
		res = False
		break
count = 0
if len(s1) == len(s2):
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			count += 1
	if count != 2:
		res = False
else:
	res = False
if res:
	print('YES')
else:
	print('NO')


import sys
import math
st1 = input()
st2 = input()
l1 = len(st1)
l2 = len(st2)
if l1 != l2:
	print('NO')
	exit()
tt = []
c = 0
for i in range(l1):
	if st1[i] != st2[i]:
		if c == 2:
			print('NO')
			exit()
		c += 1
		tt.append((st1[i], st2[i]))
if c == 2 and tt[0][0] == tt[1][1] and (tt[0][1] == tt[1][0]):
	print('YES')
else:
	print('NO')


a = input()
b = input()
c = 0
r = []
for (x, y) in zip(a, b):
	if x != y:
		c += 1
		r += [(x, y)]
print('YNEOS'[len(a) != len(b) or c != 2 or r[0] != r[1][::-1]::2])


import sys
x = input()
y = input()
if len(x) != len(y):
	print('NO')
	sys.exit(0)
diff = []
for i in range(len(x)):
	if x[i] != y[i]:
		diff.append(i)
if len(diff) != 2:
	print('NO')
	sys.exit(0)
if x[diff[0]] == y[diff[1]] and x[diff[1]] == y[diff[0]]:
	print('YES')
else:
	print('NO')


def comparingStrings():
	s1 = input()
	s2 = input()
	if len(s1) != len(s2):
		print('NO')
		return
	a = b = ''
	cset = 0
	for i in range(len(s1)):
		if s1[i] == s2[i]:
			continue
		elif s1[i] != s2[i] and cset == 0 and (i != len(s1) - 1):
			(a, b) = (s1[i], s2[i])
			cset = 1
		elif s1[i] != s2[i] and cset == 1 and ((b, a) == (s1[i], s2[i])):
			cset = 2
		elif s1[i] != s2[i]:
			print('NO')
			return
	print('YES')
comparingStrings()


a = str(input())
b = str(input())

def cha(a, b):
	import collections
	if len(a) != len(b):
		return 'NO'
	x = collections.Counter(a)
	y = collections.Counter(b)
	if x != y:
		return 'NO'
	s = 0
	i = 0
	while i < len(a):
		if a[i] != b[i]:
			s += 1
		i += 1
	if s == 2:
		return 'YES'
	else:
		return 'NO'
res = cha(a, b)
print(res)


a = input()
b = input()
l2 = []
l22 = []
res = 0
for i in range(0, min(len(b), len(a))):
	if a[i] != b[i]:
		res += 1
		l2.append(a[i])
		l22.append(b[i])
l2.sort()
l22.sort()
if res == 2 and l2 == l22 and (len(a) == len(b)):
	print('YES')
else:
	print('NO')


s1 = str(input())
s2 = str(input())
a = []
if len(s1) != len(s2):
	print('NO')
else:
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			a.append(i)
	if len(a) == 2:
		p = a[0]
		q = a[1]
		if s1[p] == s2[q] and s1[q] == s2[p]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


(s1, s2) = (input(), input())
print('YES' if len(s1) == len(s2) and sum((ch1 != ch2 for (ch1, ch2) in zip(s1, s2))) == 2 and (sorted(s1) == sorted(s2)) else 'NO')


def solve(s1, s2):
	if len(s1) != len(s2):
		return False
	total = 0
	s1_ = ''
	s2_ = ''
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			total += 1
			s1_ += s1[i]
			s2_ += s2[i]
			if total > 2:
				return False
	if total == 2 and s1_[1] == s2_[0] and (s1_[0] == s2_[1]):
		return True
	return False
s1 = input()
s2 = input()
if solve(s1, s2):
	print('YES')
else:
	print('NO')


def solve(s1, s2):
	if len(s1) != len(s2):
		return 'NO'
	else:
		diff = []
		same = []
		hasDupe = False
		for i in range(len(s1)):
			if s1[i] != s2[i]:
				if len(diff) == 0:
					diff.append(s1[i])
					diff.append(s2[i])
				elif len(diff) == 2:
					if diff[0] == s2[i] and diff[1] == s1[i]:
						diff.append(s1[i])
						diff.append(s2[i])
					else:
						return 'NO'
				else:
					return 'NO'
			if s1[i] not in same:
				same.append(s1[i])
			else:
				hasDupe = True
		if len(diff) == 0 and hasDupe == True or len(diff) == 4:
			return 'YES'
		else:
			return 'NO'
s1 = input()
s2 = input()
print(solve(s1, s2))


def isopp(s1, s2):
	if s1[0] == s2[1] and s1[1] == s2[0]:
		return True
	else:
		return False
a = input()
b = input()
n = len(a)
m = len(b)
sa = ''
sb = ''
c = 0
if n != m:
	print('NO')
else:
	for x in range(n):
		if a[x] != b[x]:
			c += 1
			sa += a[x]
			sb += b[x]
	if c == 0:
		print('YES')
	if c == 2:
		if isopp(sa, sb):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


first_input = input()
second_input = input()
count = 0
n = min(len(first_input), len(second_input))
for i in range(n):
	if first_input[i] != second_input[i]:
		count += 1
if count == 2 and set(first_input) == set(second_input):
	print('YES')
else:
	print('NO')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
	exit()
unmatch = []
for i in range(len(s1)):
	if s1[i] != s2[i]:
		unmatch.append(i)
if len(unmatch) != 2:
	print('NO')
elif s1[unmatch[0]] == s2[unmatch[1]] and s1[unmatch[1]] == s2[unmatch[0]]:
	print('YES')
else:
	print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = 1
	rr = []
	for _ in range(t):
		s = S()
		t = S()
		if len(s) != len(t):
			rr.append('NO')
		else:
			r = []
			for (a, b) in zip(s, t):
				if a != b:
					r.append((a, b))
			rr.append(YES(len(r) == 2 and r[0][0] == r[1][1] and (r[0][1] == r[1][0])))
	return JA(rr, '\n')
print(main())


a = list(input())
b = list(input())
if len(a) != len(b):
	print('NO')
	exit()
letters = set()
res = 0
for (ai, bi) in zip(a, b):
	if ai != bi:
		if res == 0:
			letters = set([ai, bi])
			res += 1
		elif set([ai, bi]) == letters:
			res += 1
		else:
			print('NO')
			exit()
	if res > 2:
		print('NO')
		exit()
print('YES' if res == 2 else 'NO')


a = list(input())
b = list(input())
count = 0
pos1 = 0
pos2 = 0
if len(a) != len(b):
	print('NO')
else:
	for i in range(len(a)):
		if a[i] != b[i]:
			count += 1
			if count == 1:
				pos1 = i
			if count == 2:
				pos2 = i
	if count > 2 or count == 1:
		print('NO')
	else:
		temp = a[pos1]
		a[pos1] = a[pos2]
		a[pos2] = temp
		if a == b:
			print('YES')
		else:
			print('NO')


s1 = str(input())
s2 = str(input())
if len(s1) != len(s2):
	print('NO')
else:
	key = []
	count = 0
	for i in range(len(s1)):
		if s1[i] != s2[i] and count == 0:
			key.append([s1[i], s2[i]])
			count += 1
		elif s1[i] != s2[i] and count > 0:
			count += 1
			key.append([s2[i], s1[i]])
	if count != 2:
		print('NO')
	elif len(key) != 2:
		print('NO')
	elif key[1] != key[0]:
		print('NO')
	else:
		print('YES')


x = input()
y = input()
x = list(x)
y = list(y)
if len(x) != len(y):
	print('NO')
else:
	m = [i for (i, j) in zip(x, y) if i != j]
	n = [j for (i, j) in zip(x, y) if i != j]
	if len(n) == 2 and len(list(set(m + n))) == 2:
		print('YES')
	else:
		print('NO')


from operator import itemgetter

def comparing_strings(genome_1_str, genome_2_str) -> str:
	difference_list = []
	if len(genome_1_str) != len(genome_2_str):
		return 'NO'
	for i in range(len(genome_1_str)):
		if genome_1_str[i] != genome_2_str[i]:
			difference_list.append((genome_1_str[i], genome_2_str[i]))
	if len(difference_list) != 2:
		return 'NO'
	if difference_list[0][0] == difference_list[1][1] and difference_list[0][1] == difference_list[1][0]:
		return 'YES'
	else:
		return 'NO'
genome_1 = input()
genome_2 = input()
print(comparing_strings(genome_1, genome_2))


first_string = input()
second_string = input()
differences = 0
list1 = []
if len(first_string) != len(second_string):
	print('NO')
else:
	for i in range(len(first_string)):
		if first_string[i] != second_string[i]:
			differences += 1
			list1.append(first_string[i])
			list1.append(second_string[i])
	if differences == 2:
		if list1[0] == list1[3] and list1[1] == list1[2]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


s1 = list(input())
s2 = list(input())
if len(s2) != len(s1):
	print('NO')
	exit()
c = 0
idx = []
for i in range(len(s2)):
	if s1[i] != s2[i]:
		c += 1
		idx.append(i)
	if c > 2:
		print('NO')
		exit()
if c != 2:
	print('NO')
	exit()
t = s1[idx[0]]
s1[idx[0]] = s1[idx[1]]
s1[idx[1]] = t
if s1 == s2:
	print('YES')
	exit()
print('NO')


a = input()
b = input()
k = 0
(a1, b1) = (sorted(a), sorted(b))
if a1 == b1:
	for i in range(len(a)):
		if a[i] != b[i]:
			k += 1
	if k == 2:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


gnome1 = list(input())
gnome2 = list(input())
if len(gnome1) != len(gnome2):
	print('NO')
else:
	differences = 0
	set = set([])
	for i in range(len(gnome1)):
		if gnome1[i] != gnome2[i]:
			differences += 1
			set.add(gnome1[i])
			set.add(gnome2[i])
	if differences == 2 and len(set) == 2:
		print('YES')
	else:
		print('NO')


g1 = input()
g2 = input()
n = len(g1)
if n != len(g2):
	print('NO')
else:
	first = -1
	second = -1
	for i in range(n):
		c1 = g1[i]
		c2 = g2[i]
		if c1 != c2:
			if first == -1:
				first = i
			else:
				second = i
				break
	new_g1 = [i for i in g1]
	new_g1.pop(first)
	new_g1.insert(first, g1[second])
	new_g1.pop(second)
	new_g1.insert(second, g1[first])
	if ''.join(new_g1) == g2:
		print('YES')
	else:
		print('NO')


A = list(input())
B = list(input())
positions = []
if A == B:
	print('YES')
else:
	if len(A) == len(B):
		for i in range(len(A)):
			if A[i] != B[i]:
				positions.append(i)
	if len(positions) != 2:
		print('NO')
	else:
		(A[positions[0]], A[positions[1]]) = (A[positions[1]], A[positions[0]])
		if A == B:
			print('YES')
		else:
			print('NO')


a = input()
n1 = len(a)
b = input()
n2 = len(b)
if n1 != n2:
	print('NO')
else:
	r = 0
	r1 = []
	for i in range(n1):
		if a[i] != b[i]:
			r += 1
			r1.append(i)
	if r == 1 or r > 2:
		print('NO')
	elif r == 0:
		print('YES')
	elif a[r1[0]] == b[r1[1]] and a[r1[1]] == b[r1[0]]:
		print('YES')
	else:
		print('NO')


from collections import Counter

def main():
	first = input().strip()
	second = input().strip()
	if len(first) != len(second):
		return False
	first_dif = []
	second_dif = []
	dif_count = 0
	for i in range(len(first)):
		if first[i] != second[i]:
			dif_count += 1
			first_dif.append(first[i])
			second_dif.append(second[i])
	if dif_count == 2:
		return first_dif[1] == second_dif[0] and first_dif[0] == second_dif[1]
	if dif_count == 0:
		for count in Counter([letter for letter in first]).values():
			if count >= 2:
				return True
	return False
if main():
	print('YES')
else:
	print('NO')


firstgenome = input()
secondgenome = input()
differences = 0
index_difference = []
if len(firstgenome) != len(secondgenome):
	print('NO')
else:
	for i in range(len(firstgenome)):
		if firstgenome[i] != secondgenome[i]:
			differences += 1
			index_difference.append(firstgenome[i])
			index_difference.append(secondgenome[i])
	if differences == 2:
		if index_difference[0] == index_difference[3] and index_difference[1] == index_difference[2]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
first = input()
second = input()
if len(first) != len(second):
	print('NO')
	exit()
count = 0
index = []
for i in range(len(first)):
	if first[i] != second[i]:
		count += 1
		index.append(i)
if count > 2 or count < 2:
	print('NO')
elif first[index[0]] != first[index[1]]:
	if first[index[0]] == second[index[1]] and first[index[1]] == second[index[0]]:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


class CodeforcesTask186ASolution:

	def __init__(self):
		self.result = ''
		self.g1 = ''
		self.g2 = ''

	def read_input(self):
		self.g1 = list(input())
		self.g2 = list(input())

	def process_task(self):
		if len(self.g1) != len(self.g2):
			self.result = 'NO'
		else:
			can_ = True
			d1 = None
			d2 = None
			for x in range(len(self.g1)):
				if self.g1[x] != self.g2[x]:
					if d1:
						d2 = x + 1
					else:
						d1 = x + 1
			if d1 and d2:
				(self.g1[d1 - 1], self.g1[d2 - 1]) = (self.g1[d2 - 1], self.g1[d1 - 1])
				self.g1 = ''.join(self.g1)
				self.g2 = ''.join(self.g2)
				can_ = self.g1 == self.g2
			elif not d1 and (not d2):
				can_ = True
			else:
				can_ = False
			self.result = 'YES' if can_ else 'NO'

	def get_result(self):
		return self.result
Solution = CodeforcesTask186ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


s1 = input()
s2 = input()
c = 0
n1 = len(s1)
n2 = len(s2)
u1 = u2 = -1
if n1 != n2:
	print('NO')
else:
	for i in range(n1):
		if s1[i] != s2[i]:
			c += 1
			if u1 == -1:
				u1 = i
			else:
				u2 = i
	if c != 2:
		print('NO')
	elif s1[u1] == s2[u2] and s1[u2] == s2[u1]:
		print('YES')
	else:
		print('NO')


k1 = input()
k2 = input()
if len(k1) != len(k2):
	print('NO')
else:
	i = 0
	j = 0
	count = 0
	list1 = []
	while True:
		if i == len(k1):
			break
		if count > 2:
			break
		if k1[i] != k2[j]:
			list1.append(i)
			count += 1
		i += 1
		j += 1
	if count == 2:
		k1 = list(k1)
		k2 = list(k2)
		temp = k1[list1[0]]
		k1[list1[0]] = k1[list1[1]]
		k1[list1[1]] = temp
		if k1 == k2:
			print('YES')
		else:
			print('NO')
	if count != 2:
		print('NO')


def main():
	st1 = input()
	st2 = input()
	n = len(st1)
	m = len(st2)
	dic1 = {}
	dic2 = {}
	for s in st1:
		if s not in dic1:
			dic1[s] = 1
		else:
			dic1[s] += 1
	for s in st2:
		if s not in dic2:
			dic2[s] = 1
		else:
			dic2[s] += 1
	if n == m:
		flag = 0
		for d in dic1:
			if d not in dic2 or dic1[d] != dic2[d]:
				flag = 1
		req = 0
		for i in range(n):
			if st1[i] != st2[i]:
				req += 1
		if req == 2 and flag == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
main()


import collections
s1 = input()
s2 = input()
c = 0
if len(s1) != len(s2):
	print('NO')
else:
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			c += 1
	if c == 2:
		d1 = collections.Counter(s1)
		d2 = collections.Counter(s2)
		for i in d1:
			if d1[i] != d2[i]:
				c = 1
				break
		if c == 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
	exit()
count = 0
ind = []
for i in range(len(s1)):
	if s1[i] != s2[i]:
		count += 1
		ind.append(i)
if count == 2 and s1[ind[0]] == s2[ind[1]] and (s1[ind[1]] == s2[ind[0]]):
	print('YES')
else:
	print('NO')


s = input()
p = input()
if sorted(list(dict.fromkeys(list(s)))) != sorted(list(dict.fromkeys(list(p)))) or len(s) != len(p):
	print('NO')
else:
	c = 0
	k = []
	for i in range(len(s)):
		if s[i] != p[i]:
			c += 1
			k.append([s[i], p[i]])
	if c == 2:
		if k[0][0] == k[1][1] and k[1][0] == k[0][1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def main():
	(s1, s2, p1, p2) = (None, None, None, None)
	str1 = input()
	str2 = input()
	n1 = len(str1)
	n2 = len(str2)
	dif = 0
	if n1 != n2:
		print('NO')
		return
	for i in range(n1):
		if dif == 3:
			print('NO')
			return
		if str1[i] != str2[i]:
			dif = dif + 1
			if s1 is not None:
				s2 = str1[i]
				p2 = str2[i]
			else:
				s1 = str1[i]
				p1 = str2[i]
	if s1 == p2 and s2 == p1:
		print('YES')
	else:
		print('NO')
		return
main()


s1 = input()
s2 = input()
if len(s1) != len(s2):
	print('NO')
	quit(0)
if s1 == s2:
	print('YES')
	quit(0)
l = len(s1)
m = []
for k in range(l):
	if s1[k] != s2[k]:
		m.append(k)
if len(m) != 2:
	print('NO')
	quit(0)
if s1[m[0]] == s2[m[1]] and s1[m[1]] == s2[m[0]]:
	print('YES')
	quit(0)
print('NO')


g1 = input()
g2 = input()
if len(g1) != len(g2):
	print('NO')
	exit()
if set(g1) == set(g2):
	count = 0
	for (i, x) in enumerate(g1):
		if x != g2[i]:
			count += 1
	if count > 2 or count < 2:
		print('NO')
	else:
		print('YES')
else:
	print('NO')


g1 = list(input().strip())
g2 = list(input().strip())
if len(g1) != len(g2):
	print('NO')
else:
	lst = []
	for i in range(len(g1)):
		if g1[i] != g2[i]:
			lst.append(i)
	if len(lst) != 2:
		print('NO')
	else:
		(g1[lst[0]], g1[lst[1]]) = (g1[lst[1]], g1[lst[0]])
		if g1 == g2:
			print('YES')
		else:
			print('NO')


from sys import stdin

def ip():
	return stdin.readline().split()
g1 = list(stdin.readline())
g2 = list(stdin.readline())
if len(g1) != len(g2):
	print('NO')
	exit()
if g1 == g2:
	print('YES')
	exit()
t = []
for i in range(len(g1)):
	if g1[i] != g2[i]:
		if len(t) > 2:
			print('NO')
			exit()
		else:
			t.append(i)
try:
	(g1[t[0]], g1[t[1]]) = (g1[t[1]], g1[t[0]])
except IndexError:
	print('NO')
	exit()
print('YES') if g1 == g2 else print('NO')


from collections import Counter
line1 = list(str(input()))
line2 = list(str(input()))
count_1 = Counter(line1)
count_2 = Counter(line2)
if count_1 != count_2:
	print('NO')
else:
	count = 0
	for (a, b) in zip(line1, line2):
		if a != b:
			count += 1
	if count == 2:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
x1 = sorted(s1)
y1 = ''.join(x1)
x2 = sorted(s2)
y2 = ''.join(x2)
c = 0
if y1 == y2:
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			c += 1
	if c == 2:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


a = input()
b = input()
(f, flag, c) = (False, True, 0)
if len(a) != len(b):
	flag = False
	print('NO')
else:
	for i in a:
		if i not in b:
			flag = False
			print('NO')
			break
	if flag == True:
		for i in b:
			if i not in a:
				flag = False
				print('NO')
				break
if flag:
	for i in range(len(a)):
		if a[i] != b[i]:
			c += 1
			if c > 2:
				break
	if c == 2:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
countS1 = [0] * 26
countS2 = [0] * 26
for x in s1:
	countS1[ord(x) - ord('a')] += 1
for x in s2:
	countS2[ord(x) - ord('a')] += 1
if countS2 != countS1:
	print('NO')
else:
	inv = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			inv += 1
	if inv != 2:
		print('NO')
	else:
		print('YES')


a = input()
b = input()
if a == b:
	print('YES')
elif len(a) != len(b):
	print('NO')
else:
	a = [i for i in a]
	b = [i for i in b]
	if sorted(a) == sorted(b):
		c = 0
		for i in range(len(a)):
			if a[i] != b[i]:
				c += 1
				if c > 2:
					print('NO')
					break
		else:
			print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
s = []
if len(s1) != len(s2):
	print('NO')
else:
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			s.append(s1[i])
			s.append(s2[i])
	if len(s) != 4:
		print('NO')
	elif s[0] == s[3] and s[1] == s[2]:
		print('YES')
	else:
		print('NO')


s = input()
d = input()
a = len(s)
b = len(d)
cnt = 0
if a != b:
	print('NO')
else:
	e = {chr(i): 0 for i in range(97, 97 + 26)}
	c = True
	for i in range(a):
		e[s[i]] -= 1
		e[d[i]] += 1
	for j in e:
		if e[j] != 0:
			c = False
			break
	for i in range(a):
		if s[i] != d[i]:
			cnt += 1
	if c and cnt <= 2:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
unique = []
cnt = 0
if len(s1) != len(s2):
	print('NO')
else:
	for x in s1:
		if x not in unique:
			unique.append(x)
	for x in unique:
		if s1.count(x) != s2.count(x):
			print('NO')
			break
	else:
		for x in range(len(s1)):
			if s1[x] != s2[x]:
				cnt += 1
		if cnt == 0 or cnt > 2:
			print('NO')
		else:
			print('YES')


from collections import Counter
first = input()
second = input()

def can_do(first, second):
	if len(first) != len(second):
		return False
	c = 0
	for_first = []
	for i in range(0, len(first)):
		if first[i] != second[i]:
			c += 1
			if c > 2:
				return False
			for_first.append(i)
	if c == 2:
		converted = list(first)
		temp = converted[for_first[0]]
		converted[for_first[0]] = converted[for_first[1]]
		converted[for_first[1]] = temp
		return ''.join(converted) == second
	return False
if can_do(first, second):
	print('YES')
else:
	print('NO')


from collections import Counter
s1 = input()
s2 = input()
m = len(s1)
n = len(s2)
if m != n:
	print('NO')
else:
	x = Counter(s1)
	y = Counter(s2)
	if x != y:
		print('NO')
	else:
		c = 0
		for i in range(n):
			if s1[i] != s2[i]:
				c += 1
		if c > 2:
			print('NO')
		else:
			print('YES')


import operator as op
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import reduce
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def def_value():
	return 0
a = input()
b = input()
if len(a) != len(b):
	print('NO')
	sys.exit()
countA = defaultdict(def_value)
countB = defaultdict(def_value)
for c in a:
	countA[c] += 1
for c in b:
	countB[c] += 1
res = 'YES'
for k in countA:
	if countA[k] != countB[k]:
		print('NO')
		sys.exit()
swapCount = 0
for i in range(len(a)):
	if swapCount > 2:
		res = 'NO'
		break
	if a[i] != b[i]:
		swapCount += 1
print(res)


def no():
	print('NO')
	exit()

def yes():
	print('YES')

def main():
	word1 = input()
	word2 = input()
	if len(word1) != len(word2):
		no()
	(diff1, diff2) = ([], [])
	for (char1, char2) in zip(word1, word2):
		if char1 != char2:
			diff1.append(char1)
			diff2.append(char2)
		if len(diff1) > 2:
			no()
	if len(diff1) != 2:
		no()
	if diff1[0] != diff2[1] or diff1[1] != diff2[0]:
		no()
	else:
		yes()
main()


a = list(input())
s = list(input())
d = a[:]
z = s[:]
d.sort()
z.sort()
if d != z:
	print('NO')
else:
	d = 0
	for i in range(len(a)):
		if a[i] != s[i]:
			d += 1
	if d > 2:
		print('NO')
	else:
		print('YES')


s1 = input()
s2 = input()
l = []
m = min(len(s2), len(s1))
for i in range(m):
	if s1[i] != s2[i]:
		l.append(i)
if len(l) > 1:
	b = s1[:l[0]] + s1[l[1]:l[1] + 1] + s1[l[0] + 1:l[1]] + s1[l[0]:l[0] + 1] + s1[l[1] + 1:]
else:
	b = ''
if b == s2:
	print('YES')
else:
	print('NO')


s1 = input()
s2 = input()
sum = 0
if sorted(s1) != sorted(s2):
	print('NO')
	exit()
for i in range(len(s1)):
	if s1[i] != s2[i]:
		sum += 1
if sum == 2:
	print('YES')
else:
	print('NO')


def fun(s1, s2):
	count = 0
	flag = True
	if len(s1) != len(s2):
		return False
	d1 = {}
	d2 = {}
	for c1 in s1:
		d1[c1] = d1.get(c1, 0) + 1
	for c2 in s2:
		d2[c2] = d2.get(c2, 0) + 1
	alphabets = 'abcdefghijklmnopqrstuvwzyz'
	flag = True
	for char in alphabets:
		if d1.get(char, 0) != d2.get(char, 0):
			return False
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			count += 1
		if count > 2:
			return False
	return flag
s1 = input()
s2 = input()
flag = fun(s1, s2)
if flag:
	print('YES')
else:
	print('NO')


a = input()
b = input()
l = len(a)
L = len(b)
if l != L:
	print('NO')
	exit()
i = 0
n = 0
arr = []
brr = []
while i < l:
	if a[i] != b[i]:
		n += 1
		if n > 2:
			print('NO')
			break
		arr.append(a[i])
		brr.append(b[i])
	i += 1
else:
	if n == 2 and arr[0] == brr[1] and (arr[1] == brr[0]):
		print('YES')
	else:
		print('NO')


s = input()
st = input()
d_1 = []
d_2 = []
l1 = len(s)
l2 = len(st)
if l1 != l2:
	print('NO')
	exit()
for i in range(l1):
	if s[i] != st[i]:
		if len(d_1) + 1 > 2:
			print('NO')
			exit()
		d_1.append(s[i])
		d_2.append(st[i])
d_1.sort()
d_2.sort()
if len(d_1) == 2 and d_1 == d_2:
	print('YES')
else:
	print('NO')


m = input()
n = input()
o = p = ''
if len(m) != len(n):
	print('NO')
else:
	for i in range(len(m)):
		if n[i] == m[i]:
			continue
		else:
			o += n[i]
			p += m[i]
	if len(o) > 3 or len(p) > 3:
		print('NO')
	elif o == p[::-1]:
		print('YES')
	else:
		print('NO')


n = input()
m = input()
count = 0
if len(n) == len(m):
	for i in range(len(n)):
		if m[i] not in n:
			print('NO')
			break
	else:
		for i in range(len(n)):
			if n[i] != m[i]:
				count += 1
		if count == 2:
			print('YES')
		else:
			print('NO')
else:
	print('NO')


a = input()
b = input()
x1 = sorted(a)
y1 = ''.join(x1)
x2 = sorted(b)
y2 = ''.join(x2)
c = 0
if y1 == y2:
	for i in range(len(a)):
		if a[i] != b[i]:
			c += 1
	if c == 2:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


s1 = input()
s2 = input()
(rs1, rs2) = (list(), list())
if len(s1) == len(s2):
	cnt = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			rs1.append(s1[i])
			rs2.append(s2[i])
	if len(rs1) == 2:
		rs1 = sorted(rs1)
		rs2 = sorted(rs2)
		if rs1 == rs2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
else:
	print('NO')


from collections import Counter
a = input()
b = input()
s = Counter(a)
t = Counter(b)
if s != t:
	print('NO')
else:
	c = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			c = c + 1
	if c % 2 == 0 and c < 4:
		print('YES')
	else:
		print('NO')


s = input()
s1 = input()
if len(s) == len(s1) and sorted(s) == sorted(s1):
	var = 0
	for i in range(len(s)):
		if s[i] != s1[i]:
			var += 1
	if var == 2:
		print('YES')
	elif var == 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


x = input()
y = input()
swap = True
(a, b) = ('', '')
swapcount = 0
if len(x) != len(y):
	print('NO')
else:
	for i in range(len(x)):
		if x[i] == y[i]:
			pass
		else:
			swapcount += 1
			if a == '':
				(a, b) = (x[i], y[i])
			elif a == y[i] and b == x[i]:
				swap = True
			else:
				swap = False
	if swapcount == 2 and swap == True:
		print('YES')
	else:
		print('NO')


a = str(input())
b = str(input())
d = ''
flag = 0
if len(a) == len(b):
	for i in range(0, len(a)):
		if a[i] != b[i]:
			if len(d) < 4:
				d = d + a[i] + b[i]
			else:
				flag = 1
				break
	if len(set(d)) == 2 and len(d) == 4 and (flag == 0):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


a = str(input())
b = str(input())
ans = 0
c = []
if len(a) != len(b):
	print('NO')
else:
	for i in range(len(a)):
		if a[i] != b[i]:
			ans += 1
			c.append(i)
	if ans != 2:
		print('NO')
	elif a[c[0]] == b[c[1]] and b[c[0]] == a[c[1]]:
		print('YES')
	else:
		print('NO')


s1 = input()
s2 = input()
c = 0
set1 = set()
set2 = set()
f = 0
if len(s1) == len(s2):
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			if c == 0:
				set1.add(s1[i])
				set1.add(s2[i])
				c += 1
			elif c == 1:
				set2.add(s1[i])
				set2.add(s2[i])
				c += 1
			else:
				f = 1
				break
else:
	f = 1
if f == 0:
	if set1 == set2:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def checker(First, Second):
	firstRight = First[:len(First) // 2]
	firstLift = First[len(First) // 2:]
	secondRight = Second[:len(Second) // 2]
	secondLift = Second[len(Second) // 2:]
	c = []
	if firstRight == secondRight and firstRight != '':
		return checker(firstLift, secondLift)
	elif secondLift == firstLift and firstLift != '':
		return checker(firstRight, secondRight)
	else:
		counter = 0
		for i in range(len(First)):
			if First[i] != Second[i]:
				counter += 1
				c.append(First[i])
				c.append(Second[i])
				if counter > 2:
					return False
		if counter == 2 and (c[0], c[1]) == (c[-1], c[-2]):
			return True
		else:
			return False
(x, y) = (input(), input())
if len(x) != len(y):
	print('NO')
elif checker(x, y):
	print('YES')
else:
	print('NO')


a = list(input())
b = list(input())
count = 0
m = sorted(a)
n = sorted(b)
if m == n:
	for i in range(len(m)):
		if a[i] != b[i]:
			count += 1
	if count == 2:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


from collections import Counter
a = input()
b = input()
if Counter(a) == Counter(b):
	a = list(a)
	b = list(b)
	ind = []
	for i in range(len(a)):
		if a[i] != b[i]:
			ind.append(i)
	(a[ind[0]], a[ind[1]]) = (a[ind[1]], a[ind[0]])
	if a == b:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


(s1, s2) = (list(input()), list(input()))
cnt = 0
(r, t) = ('', '')
if len(s1) != len(s2):
	print('NO')
	exit()
for i in range(len(s1)):
	if s1[i] != s2[i]:
		cnt += 1
		r += s1[i]
		t += s2[i]
	if cnt > 2:
		break
print('NO YES'.split()[cnt == 0 or (cnt == 2 and r == t[::-1])])


s1 = input()
s2 = input()
l1 = []
l2 = []
for i in s1:
	l1.append(i)
for i in s2:
	l2.append(i)
c = 0
x = True
p = []
x = -1
if len(s1) != len(s2):
	print('NO')
else:
	for i in range(len(l1)):
		if l1[i] == l2[i]:
			continue
		else:
			if x != -1:
				temp = l1[x]
				l1[x] = l1[i]
				l1[i] = temp
				break
			x = i
	if l1 == l2:
		print('YES')
	else:
		print('NO')


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
ls = lambda : list(input().strip())
from collections import defaultdict as df
import heapq
infinite = float('inf')
s1 = ls()
s2 = ls()
i = 0
if len(s1) != len(s2):
	print('NO')
else:
	c = 0
	index1 = index2 = -1
	while i < len(s1):
		if s1[i] != s2[i]:
			c += 1
			if c == 1:
				index1 = i
			else:
				index2 = i
		i += 1
	if c != 2:
		print('NO')
	elif s1[index1] == s2[index2] and s1[index2] == s2[index1]:
		print('YES')
	else:
		print('NO')


a = input()
b = input()
if set(a) != set(b) or len(a) != len(b):
	print('NO')
else:
	(dif, tmp) = (0, True)
	for i in range(len(a)):
		if a[i] != b[i]:
			dif += 1
		if dif > 2:
			print('NO')
			tmp = False
			break
	if tmp:
		print('YES')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
else:
	cnt = 0
	first = []
	second = []
	for i in range(len(a)):
		if cnt > 2:
			break
		if a[i] != b[i]:
			cnt += 1
			first.append(a[i])
			second.append(b[i])
	first.sort()
	second.sort()
	if cnt == 2:
		if first[0] == second[0] and first[1] == second[1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


s1 = input()
s2 = input()
a = len(s1)
b = len(s2)
if a != b:
	print('NO')
else:
	c = 0
	for i in range(a):
		if s1[i] != s2[i]:
			if c == 0:
				(x1, x2) = (s1[i], s2[i])
			elif c == 1:
				(y1, y2) = (s1[i], s2[i])
			c = c + 1
	if c == 2:
		if x1 == y2 and x2 == y1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


x = input()
y = input()
if sorted(x) != sorted(y):
	print('NO')
else:
	deff = 0
	can = False
	for (a, b) in zip(x, y):
		if a != b:
			deff += 1
		if not can and x.count(a) > 1:
			can = True
	if deff == 2 or (deff == 0 and can):
		print('YES')
	else:
		print('NO')


n = list(input())
m = list(input())
count = 0
c = []
if len(n) != len(m):
	print('NO')
	exit(0)
for i in range(len(n)):
	if n[i] != m[i]:
		count += 1
		c.append(i)
	if count > 2:
		print('NO')
		exit(0)
if count != 2:
	print('NO')
	exit(0)
if n[c[0]] == m[c[1]] and n[c[1]] == m[c[0]]:
	print('YES')
else:
	print('NO')


list_1 = list(input())
list_2 = list(input())
list_3 = []
if len(list_1) == len(list_2):
	for i in range(len(list_1)):
		if list_1[i] != list_2[i]:
			list_3.append(list_1[i])
			list_3.append(list_2[i])
	if len(list_3) == 4:
		if list_3[0] == list_3[-1] and list_3[2] == list_3[1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
else:
	print('NO')


p = input()
p = p.replace('', ' ')
p = p.split()
q = input()
q = q.replace('', ' ')
q = q.split()
if len(p) == len(q):
	c = 0
	l = []
	for i in range(len(p)):
		if p[i] != q[i]:
			c += 1
			l.append(p[i])
			l.append(q[i])
	if c == 2:
		d = 0
		for i in range(4):
			if l.count(l[i]) != 2:
				d = 1
				break
		if d == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
else:
	print('NO')


s = input()
sa = input()
if len(s) != len(sa):
	print('NO')
else:
	d = []
	for i in range(len(s)):
		if s[i] != sa[i]:
			d.append(i)
	if len(d) == 2:
		if s[d[0]] == sa[d[1]] and s[d[1]] == sa[d[0]]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


s = input()
t = input()
c = 0
p1 = p2 = 0
if len(s) != len(t):
	print('NO')
	exit()
for i in range(len(s)):
	if s[i] != t[i]:
		if c == 0:
			p1 = i
		else:
			p2 = i
		c += 1
	if c > 2:
		print('NO')
		exit()
if c != 1:
	s = list(s)
	(s[p1], s[p2]) = (s[p2], s[p1])
	if s[p1] == t[p1] and s[p2] == t[p2]:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


(s, t) = (input(), input())
print('YES' if sum((x != y for (x, y) in zip(s, t))) == 2 and all((y in s for y in t)) else 'NO')


def solve():
	a = input()
	b = input()
	if len(a) != len(b):
		print('NO')
		return
	difs = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			difs += 1
	if ''.join(sorted(a)) == ''.join(sorted(b)) and difs == 2:
		print('YES')
	else:
		print('NO')
solve()


import sys
s1 = sys.stdin.readline()[:-1]
s2 = sys.stdin.readline()[:-1]
a1 = {}
a2 = {}
if len(s1) != len(s2):
	print('NO')
else:
	count = 0
	for i in range(len(s1)):
		if s1[i] not in a1:
			a1[s1[i]] = 0
		a1[s1[i]] += 1
		if s2[i] not in a2:
			a2[s2[i]] = 0
		a2[s2[i]] += 1
		if s1[i] != s2[i]:
			count += 1
		if count > 2:
			break
	if a1 == a2 and count <= 2:
		print('YES')
	else:
		print('NO')


s1 = list(input())
s2 = list(input())
l = []
try:
	for i in range(0, max(len(s1), len(s2))):
		if s1[i] != s2[i]:
			l.append(s1[i])
			l.append(s2[i])
except:
	print('NO')
	exit(0)
print('YES' if len(l) == 4 and l[0] == l[3] and (l[1] == l[2]) else 'NO')


s1 = list(input())
s2 = list(input())
if len(s1) != len(s2):
	print('NO')
	exit(0)
sum = 0
cnt = 0
for i in range(0, len(s1)):
	sum += ord(s1[i]) - ord(s2[i])
	if ord(s1[i]) - ord(s2[i]) != 0:
		cnt += 1
print('YES' if sum == 0 and cnt <= 2 else 'NO')


from collections import Counter
a = input()
b = input()
print('NYOE S'[Counter(a) == Counter(b) and sum((i != j for (i, j) in zip(a, b))) == 2::2])


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
a = RW()
b = RW()
if a == b:
	Print('YES')
else:
	count = 0
	if sorted(a) != sorted(b):
		print('NO')
	else:
		for i in range(len(b)):
			if a[i] != b[i]:
				count += 1
		print('YES' if count == 2 else 'NO')


(a, b) = (input(), input())
(i, j, k) = (0, 0, 0)
if len(a) != len(b):
	print('NO')
else:
	for n in range(len(a)):
		if a[n] != b[n]:
			(i, j, k) = (n, i, k + 1)
	if k == 2 and a[i] == b[j] and (a[j] == b[i]):
		print('YES')
	else:
		print('NO')


n = input()
m = input()
l = []
s = ''
if len(n) != len(m):
	print('NO')
	exit()
for x in range(len(n)):
	if n[x] != m[x]:
		l.append(x)
		if len(l) > 2:
			print('NO')
			exit()
if len(l) == 2:
	s = s + n[:l[0]] + n[l[1]] + n[l[0] + 1:l[1]] + n[l[0]] + n[l[1] + 1:]
if s == m:
	print('YES')
else:
	print('NO')


s = str(input())
s1 = str(input())
count = 0
c = 0
l = []
p = []
if len(s) == len(s1):
	for i in range(len(s)):
		if s[i] != s1[i]:
			l.append(ord(s[i]))
			l.append(ord(s1[i]))
			p.append(ord(s[i]))
			count += 1
		if count >= 3:
			c = 1
			break
	if c == 1:
		print('NO')
	elif len(set(l)) == 2 and count == 2 and (len(set(p)) != 1):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


s = input()
l1 = []
d = input()
l2 = []
sam = 0
diff = 0
if len(s) != len(d):
	print('NO')
else:
	for i in range(len(s)):
		if s[i] == d[i]:
			sam += 1
		else:
			l1.append(s[i])
			l2.append(d[i])
	if len(s) - sam > 2 or len(s) - sam < 2:
		print('NO')
	else:
		l1.sort()
		l2.sort()
		if l1 == l2:
			print('YES')
		else:
			print('NO')


a = input()
b = input()
if len(a) != len(b):
	print('NO')
else:
	differences = []
	for i in range(len(a)):
		if a[i] != b[i]:
			differences.append(i)
	if len(differences) != 2:
		print('NO')
	else:
		i = differences[0]
		j = differences[1]
		if a[i] == b[j] and a[j] == b[i]:
			print('YES')
		else:
			print('NO')


s1 = list(input())
s2 = list(input())
s3 = s1[:]
s4 = s2[:]
s3.sort()
s4.sort()
k = 0
if s3 != s4 or len(s3) != len(s4):
	print('NO')
else:
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			k = k + 1
	if k == 2:
		print('YES')
	else:
		print('NO')


string1 = list(input())
string2 = list(input())
one = len(string1)
two = len(string2)
if one != two:
	print('NO')
else:
	c = 0
	l = []
	for i in range(one):
		if string1[i] != string2[i]:
			c += 1
			l.append(i)
	if c != 2:
		print('NO')
	else:
		(string1[l[0]], string1[l[1]]) = (string1[l[1]], string1[l[0]])
		if ''.join(string1) == ''.join(string2):
			print('YES')
		else:
			print('NO')


a = list(input())
b = list(input())
c = sorted(a)
d = sorted(b)
k = 0
if c != d or len(a) != len(b):
	print('NO')
else:
	for i in range(len(a)):
		if a[i] != b[i]:
			k += 1
	if k == 2:
		print('YES')
	else:
		print('NO')


s = input()
t = input()
A = []
B = []
for i in range(min(len(s), len(t))):
	if s[i] != t[i]:
		A.append(s[i])
		B.append(t[i])
if len(A) != 2 or len(s) != len(t):
	print('NO')
elif A[0] != B[1] or A[1] != B[0]:
	print('NO')
else:
	print('YES')


from collections import Counter
l = list(input())
l1 = list(input())
a = Counter(l)
b = Counter(l1)
c = list(a.keys())
d = list(b.keys())
c.sort()
d.sort()
if c != d:
	print('NO')
	exit()
for i in c:
	if a[i] != b[i]:
		print('NO')
		exit()
e = len(l)
t = 0
for i in range(e):
	if l1[i] != l[i]:
		t += 1
	if t > 2:
		print('NO')
		exit()
if t == 1:
	print('NO')
else:
	print('YES')


def gint():
	return int(input())

def gint_arr():
	return list(map(int, input().split()))

def gfloat():
	return float(input())

def gfloat_arr():
	return list(map(float, input().split()))

def pair_int():
	return map(int, input().split())
INF = 1 << 31
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
a = input()
b = input()
la = len(a)
lb = len(b)
(ind1, ind2) = (-1, -1)
i = 0
rep = False
s = set()
while i < la and i < lb:
	rep |= a[i] in s
	s.add(a[i])
	if a[i] != b[i]:
		if ~ind1:
			ind2 = i
		else:
			ind1 = i
	i += 1
if ~ind1 and ~ind2:
	a = a[:ind1] + a[ind2] + a[ind1 + 1:ind2] + a[ind1] + a[ind2 + 1:]
	print('YES' if a == b else 'NO')
elif ~ind1 or ~ind2:
	print('NO')
else:
	print('YES' if rep and len(a) == len(b) else 'NO')


x1 = list(input())
x2 = list(input())
if len(x1) != len(x2):
	print('NO')
else:
	flag = 0
	ind = 0
	for i in range(len(x1)):
		if x1[i] == x2[i]:
			continue
		elif flag == 0:
			ind = i
			flag = 1
		elif flag == 1:
			if x1[i] == x2[ind] and x2[i] == x1[ind]:
				flag = 2
			else:
				flag = 3
				break
		else:
			flag = 3
			break
	if flag == 2:
		print('YES')
	else:
		print('NO')


(first, second) = (input(), input())
(f_len, s_len) = (len(first), len(second))
if f_len != s_len:
	exit(print('NO'))
(ix, c) = ([], 0)
for i in range(f_len):
	if first[i] != second[i]:
		ix.append(i)
		c += 1
	if c > 2:
		exit(print('NO'))
if c == 1:
	exit(print('NO'))
if first[ix[0]] == second[ix[1]] and first[ix[1]] == second[ix[0]]:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline())
is1 = lambda : stdin.readline()
iia = lambda : map(int, stdin.readline().split())
isa = lambda : stdin.readline().split()
a = is1()
b = is1()
temp = []
for (i, j) in zip(a, b):
	if i != j:
		temp.append([i, j])
if len(temp) == 2 and temp[0][0] == temp[1][1] and (temp[0][1] == temp[1][0]):
	print('YES')
else:
	print('NO')


s1 = input().strip()
s2 = input().strip()
if len(s1) != len(s2):
	print('NO')
else:
	prev = False
	count = 0
	for i in range(len(s1)):
		if s1[i] == s2[i]:
			continue
		count += 1
		if not prev:
			prev = True
			first = s1[i]
			second = s2[i]
		elif s2[i] == first and s1[i] == second:
			continue
		else:
			print('NO')
			break
	else:
		if count == 2:
			print('YES')
		else:
			print('NO')


class Stack:

	def __init__(self):
		self.items = []

	def isEmpty(self):
		return self.items == []

	def push(self, item):
		self.items.append(item)

	def pop(self):
		return self.items.pop()

	def peek(self):
		return self.items[len(self.items) - 1]

	def size(self):
		return len(self.items)
firstName = input()
secondName = input()
swapStack = Stack()
count = 0
if len(firstName) != len(secondName):
	print('NO')
	exit()
for i in range(len(firstName)):
	if firstName[i] != secondName[i]:
		if count <= 2:
			swapStack.push(i)
			count += 1
		else:
			print('NO')
			exit()
if count == 2:
	firstIndex = swapStack.pop()
	secondIndex = swapStack.pop()
else:
	print('NO')
	exit()
if firstName[firstIndex] == secondName[secondIndex] and firstName[secondIndex] == secondName[firstIndex]:
	print('YES')
else:
	print('NO')


one = input()
two = input()
if len(one) != len(two):
	print('NO')
elif len(one) == len(two) == 2:
	if one[::-1] == two:
		print('YES')
	else:
		print('NO')
else:
	count = 0
	j = 0
	index = [0, 0, 0]
	for i in range(0, len(one)):
		if one[i] != two[i]:
			count = count + 1
			index[j] = i
			j = j + 1
		if count > 2:
			break
	if count == 2:
		if one[index[0]] == two[index[1]] and one[index[1]] == two[index[0]]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from collections import Counter
string1 = input()
string2 = input()
if Counter(string1) != Counter(string2):
	print('NO')
else:
	res = []
	flag = 2
	for i in range(len(string1)):
		if string1[i] != string2[i]:
			res.append([string1[i], string2[i]])
	if len(res) != 2:
		flag = 0
		print('NO')
	elif len(res) == 2:
		flag = 1
		for pair in res:
			pair.sort()
	if flag == 1:
		if res[0] == res[1]:
			print('YES')
	elif flag == 2:
		print('NO')


s = str(input())
s1 = str(input())
if len(s) == len(s1):
	sum = 0
	count = 0
	for i in range(0, len(s), 1):
		if s[i] != s1[i]:
			sum += 1
			count += ord(s[i]) - ord(s1[i])
			if sum > 2:
				break
	if count == 0 and sum == 2:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def k(s1, s2):
	s1len = len(s1)
	flag = False
	count = 0
	if s1len == len(s2):
		extra1 = 0
		for i in range(s1len):
			if s1[i] != s2[i]:
				count += 1
				if count == 2:
					if s1[i] == s2[extra1] and s2[i] == s1[extra1]:
						flag = True
				extra1 = i
	else:
		return 'NO'
	if count == 0 or (flag and count == 2):
		return 'YES'
	else:
		return 'NO'
s1 = input()
s2 = input()
print(k(s1, s2))