Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, ababa is adorable (you can transform it to aaabb, where the first three letters form a group of a-s and others — a group of b-s), but cccc is not since in each possible consequent partition letters in these two groups coincide.

You're given a string s. Check whether it can be split into two non-empty subsequences such that the strings formed by these subsequences are adorable. Here a subsequence is an arbitrary set of indexes of the string.


-----Input-----

The only line contains s (1 ≤ |s| ≤ 10^5) consisting of lowercase latin letters.


-----Output-----

Print «Yes» if the string can be split according to the criteria above or «No» otherwise.

Each letter can be printed in arbitrary case.


-----Examples-----
Input
ababa

Output
Yes

Input
zzcxx

Output
Yes

Input
yeee

Output
No



-----Note-----

In sample case two zzcxx can be split into subsequences zc and zxx each of which is adorable.

There's no suitable partition in sample case three.

Difficulty: MEDIUM
Tags: Implementation

Starter code:

Solutions:
s = input()
cnt = [0 for i in range(26)]
for el in s:
	cnt[ord(el) - ord('a')] += 1
tps = 0
nos = 0
for i in range(26):
	if cnt[i] > 0:
		tps += 1
	if cnt[i] > 1:
		nos += 1

def f():
	if tps > 4:
		return False
	if tps < 2:
		return False
	if tps == 2:
		if nos < 2:
			return False
		return True
	if tps == 3:
		if len(s) > 3:
			return True
		return False
	return True
if f():
	print('Yes')
else:
	print('No')


from collections import defaultdict
s = input()
m = defaultdict(int)
for c in s:
	m[c] += 1
cnts = [j for (i, j) in m.items()]
if len(s) < 4 or len(cnts) > 4 or len(cnts) == 1 or (len(cnts) == 2 and min(cnts) == 1):
	print('No')
else:
	print('Yes')


s = input()
d = {}
a = set()
for i in s:
	if i not in d:
		d[i] = 1
		a.add(i)
	else:
		d[i] += 1
if len(d) > 4 or len(d) <= 1:
	print('No')
elif len(d) == '4':
	print('Yes')
else:
	y = []
	for j in a:
		y.append(d[j])
	y.sort()
	if y[0] >= 2:
		print('Yes')
	elif len(y) == 2 and y[0] == 1:
		print('No')
	elif len(y) == 3 and y[2] == 1:
		print('No')
	else:
		print('Yes')


d = {}
s = input()
for l in s:
	if l not in d:
		d[l] = 0
	d[l] += 1
if len(d) > 4:
	print('No')
elif len(d) == 3:
	if len(s) > 3:
		print('Yes')
	else:
		print('No')
elif len(d) == 2:
	for k in d:
		if d[k] < 2:
			print('No')
			exit()
	print('Yes')
elif len(d) == 4:
	print('Yes')
else:
	print('No')


x = input()
s = [x[0]]
c = [x.count(x[0])]
for i in x[1:]:
	if i not in s:
		s += [i]
		c += [x.count(i)]
if len(s) == 4:
	print('YES')
elif len(s) == 2 and c[0] > 1 and (c[1] > 1):
	print('YES')
elif len(s) == 3 and (c[0] > 1 or c[1] > 1 or c[2] > 1):
	print('YES')
else:
	print('NO')


s = input()
q = {}
for i in range(len(s)):
	q[s[i]] = q.get(s[i], 0)
	q[s[i]] += 1
if len(q) == 1:
	print('No')
elif len(q) == 2:
	l = list(q.values())
	if l[0] > 1 and l[1] > 1:
		print('Yes')
	else:
		print('No')
elif len(q) == 3:
	l = list(q.values())
	if l[0] > 1 or l[1] > 1 or l[2] > 1:
		print('Yes')
	else:
		print('No')
elif len(q) == 4:
	print('Yes')
else:
	print('No')


from collections import Counter
s = input()
A = [char for char in s]
A.sort()
c = Counter(A)
if len(c.keys()) > 4:
	print('No')
elif len(c.keys()) == 4:
	print('Yes')
elif len(c.keys()) == 3:
	z = list(c.values())
	if z == [1, 1, 1]:
		print('No')
	else:
		print('Yes')
elif len(c.keys()) == 2:
	z = list(c.values())
	if 1 in z:
		print('No')
	else:
		print('Yes')
else:
	print('No')


a = input()
s = set(a)
if len(s) > 4:
	print('No')
	exit()
if len(s) == 4:
	print('Yes')
	exit()
if len(s) == 3:
	if len(a) == 3:
		print('No')
	else:
		print('Yes')
if len(a) == 2 or len(s) == 1:
	print('No')
	exit()
if len(s) == 2:
	st = sorted(a)
	if st.count(st[0]) <= len(st) - 2 and st.count(st[0]) >= 2:
		print('Yes')
	else:
		print('No')


T = input()
D = {}
for i in T:
	if i in D:
		D[i] += 1
	else:
		D[i] = 1
R = []
for i in D:
	R.append(D[i])
if len(R) == 4:
	print('YES')
elif len(R) == 3:
	if max(R) >= 2:
		print('YES')
	else:
		print('NO')
elif len(R) == 2:
	if min(R) >= 2:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


from collections import defaultdict
s = input()
d = defaultdict(int)
for i in s:
	d[i] += 1
if len(s) < 4:
	print('No')
	exit()
vals = sorted(d.values())
if len(vals) == 1:
	print('No')
elif len(vals) == 2:
	if vals[0] == 1:
		print('No')
	else:
		print('Yes')
elif len(vals) == 3:
	print('Yes')
elif len(vals) == 4:
	print('Yes')
elif len(vals) > 4:
	print('No')


s = input()
chars = {}
for c in s:
	if c not in chars:
		chars[c] = 0
	chars[c] += 1
if len(chars.keys()) == 1 or len(chars.keys()) > 4:
	print('No')
elif len(chars.keys()) == 2:
	one = 0
	for key in chars:
		if chars[key] == 1:
			one += 1
	if one == 0:
		print('Yes')
	else:
		print('No')
elif len(chars.keys()) == 3:
	one = 0
	for key in chars:
		if chars[key] == 1:
			one += 1
	if one <= 2:
		print('Yes')
	else:
		print('No')
elif len(chars.keys()) == 4:
	print('Yes')


from collections import Counter
s = input()
c = Counter(s)
if len(s) < 4 or len(c) > 4 or len(c) <= 1:
	print('No')
	exit(0)
if len(c) >= 3:
	print('Yes')
	exit(0)
print('Yes') if min(c.values()) > 1 else print('No')


import logging
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.addHandler(ch)

def solve(s):
	chars = list(set(s))
	if not 2 <= len(chars) <= 4:
		return False
	if len(chars) == 2 and (s.count(chars[0]) < 2 or s.count(chars[1]) < 2):
		logger.debug('%s, %s', s.count(chars[0]) < 2, s.count(chars[1]) < 2)
		return False
	if len(chars) == 3:
		if not any((s.count(c) > 1 for c in chars)):
			return False
	return True

def main():
	s = input().strip()
	result = solve(s)
	print('Yes' if result else 'No')
main()


q = [str(x) for x in input()]
s = set(q)
l = len(s)
flag = 0
if l == 2 or l == 4:
	flag = 1
	if l == 2 and any((q.count(x) < 2 for x in s)):
		flag = 0
if l == 3:
	if any((q.count(x) > 1 for x in s)):
		flag = 1
print('Yes' if flag else 'No')


from collections import Counter
string = str(input())
distinctChracter = len(set(string))
if distinctChracter > 4:
	print('No')
elif len(string) < 4:
	print('No')
elif distinctChracter == 4:
	print('Yes')
elif distinctChracter == 1:
	print('No')
elif distinctChracter == 3 and len(string) >= 4:
	print('yes')
elif distinctChracter == 2:
	d = Counter(string)
	if any((d[k] == 1 for k in d)):
		print('No')
	else:
		print('Yes')


class CodeforcesTask955BSolution:

	def __init__(self):
		self.result = ''
		self.s = ''

	def read_input(self):
		self.s = input()

	def process_task(self):
		chars = set([ord(c) for c in self.s])
		if len(chars) > 4:
			self.result = 'No'
		elif len(chars) == 1:
			self.result = 'No'
		elif len(chars) == 4:
			self.result = 'Yes'
		elif len(chars) == 3:
			if len(self.s) < 4:
				self.result = 'No'
			else:
				self.result = 'Yes'
		else:
			cnts = self.s.count(self.s[0])
			if len(self.s) - cnts == 1 or cnts == 1:
				self.result = 'No'
			else:
				self.result = 'Yes'

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


n = input()
b = list(set(n))
if len(b) in range(2, 5):
	if len(b) == 2:
		if n.count(b[0]) < 2 or n.count(b[1]) < 2:
			print('NO')
		else:
			print('YES')
	elif len(n) >= 4:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


from collections import Counter
d = Counter(input())
if sum(d.values()) < 4 or len(d) > 4 or len(d) == 1:
	print('NO')
elif len(d) >= 3:
	print('YES')
elif any((d[k] == 1 for k in d)):
	print('NO')
else:
	print('YES')


st = input()
st = list(st)
flg = 0
n = len(set(st))
if n == 3:
	for i in set(st):
		if st.count(i) >= 2:
			flg = 1
			break
elif n == 2:
	for i in set(st):
		if st.count(i) == 1:
			flg = 0
			break
		else:
			flg = 1
elif n == 1 or n > 4:
	flg = 0
elif n == 4:
	flg = 1
if flg == 1:
	print('Yes')
else:
	print('No')


A = input()
zzz = 0
if len({elem: elem for elem in list(A)}) > 4 or len({elem: elem for elem in list(A)}) < 2:
	ans = 'NO'
elif len({elem: elem for elem in list(A)}) == 2:
	d = dict.fromkeys(A, 0)
	for c in A:
		d[c] += 1
	if 2 <= d[A[1]] < len(A) - 1:
		ans = 'YES'
	else:
		ans = 'NO'
elif len({elem: elem for elem in list(A)}) == 3:
	if len(A) > 3:
		ans = 'YES'
	else:
		ans = 'NO'
elif len({elem: elem for elem in list(A)}) == 4:
	ans = 'YES'
print(ans)


import sys
from collections import Counter
readline = sys.stdin.readline
T = list(map(ord, readline().strip()))
S = Counter(T)
V = list(S.values())
V.sort(reverse=True)
ans = 'No'
if len(V) == 2:
	if all((v >= 2 for v in V)):
		ans = 'Yes'
elif len(V) == 3:
	if V[0] >= 2:
		ans = 'Yes'
elif len(V) == 4:
	ans = 'Yes'
print(ans)


s = {}
i = input()
for ch in i:
	if ch in s:
		s[ch] += 1
	else:
		s[ch] = 1
if len(s) > 4:
	print('No')
elif len(s) == 4:
	print('Yes')
elif len(s) == 3:
	print('Yes' if len(i) > 3 else 'No')
elif len(s) == 2:
	if all((x >= 2 for x in s.values())):
		print('Yes')
	else:
		print('No')
elif len(s) == 1:
	print('No')


from collections import defaultdict as dd, deque
H = dd(int)
s = input()
for c in s:
	H[c] += 1
if len(H) == 4 or (len(H) == 3 and max(H.values()) > 1) or (len(H) == 2 and min(H.values()) > 1):
	print('Yes')
else:
	print('No')


s = dict()
for symb in list(input()):
	s[symb] = s.get(symb, 0) + 1
cnt = 0
c = []
for i in s.values():
	c.append(i)
	cnt += 1
if cnt == 4:
	print('Yes')
elif cnt == 3:
	if c[0] > 1 or c[1] > 1 or c[2] > 1:
		print('Yes')
	else:
		print('No')
elif cnt == 2:
	if c[0] > 1 and c[1] > 1:
		print('Yes')
	else:
		print('No')
else:
	print('No')


from collections import Counter
cr = list(dict(Counter(input())).values())
if len(cr) > 4 or len(cr) == 1:
	print('No')
elif len(cr) == 4:
	print('Yes')
elif len(cr) == 3:
	print('Yes' if max(cr) > 1 else 'No')
elif len(cr) == 2:
	print('Yes' if cr[0] > 1 and cr[1] > 1 else 'No')


str = input()
st = [0 for x in range(26)]
st2 = [0 for x in range(26)]
if len(str) < 4:
	print('No')
	exit()
df = 0
for i in range(len(str)):
	st[ord(str[i]) - 97] += 1
	if st2[ord(str[i]) - 97] != 1:
		df += 1
		st2[ord(str[i]) - 97] += 1
	if df > 4:
		print('No')
		exit()
if df == 2 and 1 in st or df == 1:
	print('No')
	exit()
print('YES')


s = str(input())
d = dict()
for i in s:
	d[i] = d.get(i, 0) + 1
cnt = 0
m = 0
f = []
for key in d:
	cnt = cnt + 1
	f.append(d[key])
	m = max(m, d[key])
if cnt == 1:
	print('No')
elif cnt == 2:
	if f[0] >= 2 and f[1] >= 2:
		print('Yes')
	else:
		print('No')
elif cnt == 3:
	if m >= 2:
		print('Yes')
	else:
		print('No')
elif cnt == 4:
	print('Yes')
else:
	print('No')


s = list(input())
s.sort()
if len(s) < 4:
	print('No')
else:
	st = set(s)
	if len(st) > 4:
		print('No')
	elif len(st) < 2:
		print('No')
	elif len(st) == 2:
		c1 = s.count(s[0])
		c2 = s.count(s[-1])
		if c1 < 2 or c2 < 2:
			print('No')
		else:
			print('Yes')
	else:
		print('Yes')


from collections import Counter

def main():
	S = input()
	counter = Counter(S)
	topn = counter.most_common()
	cnt = len(topn)
	if cnt == 4:
		ans = 'Yes'
	elif cnt == 3:
		if len(S) > 3:
			ans = 'Yes'
		else:
			ans = 'No'
	elif cnt == 2:
		if topn[0][1] > 1 and topn[1][1] > 1:
			ans = 'Yes'
		else:
			ans = 'No'
	else:
		ans = 'No'
	print(ans)
main()


s = input()
t = set(s)
l = len(t)
print(['No', 'Yes'][2 <= l <= 4 and l + sum((s.count(x) >= 2 for x in t)) >= 4])


s = input()
d = {}
for i in range(len(s)):
	try:
		d[s[i]] += 1
	except KeyError:
		d[s[i]] = 1
if len(d) > 4:
	print('No')
if len(d) == 4:
	print('Yes')
if len(d) == 3:
	for i in d:
		if d[i] > 1:
			print('Yes')
			exit()
	print('No')
if len(d) == 2:
	f = 0
	for i in d:
		if d[i] <= 1:
			f = 1
	if f:
		print('No')
	else:
		print('Yes')
if len(d) <= 1:
	print('No')


s = input()

def bstring(s):
	d = dict()
	for letter in s:
		d[letter] = d.get(letter, 0) + 1
	if len(d.keys()) > 4 or len(d.keys()) < 2:
		return 'No'
	elif len(d.keys()) == 4:
		return 'Yes'
	elif len(d.keys()) == 2:
		for c in d.values():
			if c == 1:
				return 'No'
		return 'Yes'
	elif len(d.keys()) == 3:
		for c in d.values():
			if c >= 2:
				return 'Yes'
		return ' No'
print(bstring(s))


x = input()
d = {}
for l in 'abcdefghijklmnopqrstuvwxyz':
	if l in x:
		d[l] = x.count(l)

def panic():
	print('No')
	exit(0)

def ok():
	print('Yes')
	exit(0)
cnt = len(d.keys())
nums = sorted(d.values())
if cnt == 2 and nums[0] > 1 and (nums[1] > 1):
	ok()
if cnt == 3 and max(nums) > 1:
	ok()
if cnt == 4:
	ok()
panic()


s = input()
L = {}
for l in s:
	if not l in L:
		L[l] = 1
		if len(L) > 4:
			break
	else:
		L[l] += 1
if len(L) == 1:
	print('No')
elif len(L) == 2:
	if len([x for x in L.values() if x >= 2]) == 2:
		print('Yes')
	else:
		print('No')
elif len(L) == 3:
	if len([x for x in L.values() if x >= 2]) >= 1:
		print('Yes')
	else:
		print('No')
elif len(L) == 4:
	print('Yes')
else:
	print('No')


string = input()
d = {}
for c in string:
	try:
		d[c] += 1
	except:
		d[c] = 1
if len(d) == 1:
	print('No')
elif len(d) == 2:
	valid = True
	for v in d.values():
		if v == 1:
			valid = False
			break
	if valid:
		print('Yes')
	else:
		print('No')
elif len(d) == 3:
	if len(string) > 3:
		print('Yes')
	else:
		print('No')
elif len(d) == 4:
	print('Yes')
else:
	print('No')


s = input()
kol = 0
for i in range(26):
	if chr(i + 97) in s:
		kol += 1
tmp = list(set(s))
if kol == 4:
	print('Yes')
elif kol == 3 and len(s) != 3:
	print('Yes')
elif kol == 2 and s.count(tmp[0]) != 1 and (s.count(tmp[1]) != 1):
	print('Yes')
else:
	print('No')


import re
import math
import decimal
import bisect

def read():
	return input().strip()
can = False
word = read()
if len(word) < 4:
	can = False
else:
	chars = {}
	for c in word:
		if c not in chars:
			chars[c] = 1
		else:
			chars[c] += 1
	vals = sorted(chars.values())
	if len(chars) > 4 or len(chars) == 1:
		can = False
	elif len(chars) == 2:
		can = vals[0] > 1 and vals[1] > 1
	else:
		can = True
print('Yes' if can else 'No')


s = input()
letters = [0] * 26
if len(s) < 4:
	print('No')
else:
	for i in range(len(s)):
		letters[ord(s[i]) - 97] += 1
	kolvo = 0
	for i in range(26):
		if letters[i] > 0:
			kolvo += 1
	if kolvo > 4:
		print('No')
	elif kolvo == 3:
		print('Yes')
	elif kolvo == 1:
		print('No')
	elif kolvo == 2:
		a = 0
		b = 0
		for i in range(len(letters)):
			if letters[i] != 0 and a == 0:
				a += letters[i]
			elif letters[i] != 0 and a != 0:
				b += letters[i]
		if a != 1 and b != 1:
			print('Yes')
		else:
			print('No')
	elif kolvo == 4:
		print('Yes')


from sys import exit
s = input()
c = [0] * 26
for i in s:
	c[ord(i) - ord('a')] += 1
use = 0
for i in c:
	if i != 0:
		use += 1
if use == 1 or use > 4:
	print('No')
	exit(0)
if use == 4:
	print('Yes')
	exit(0)
if use == 3:
	if len(s) >= 4:
		print('Yes')
	else:
		print('No')
	exit(0)
for i in c:
	if i != 0:
		sav = i
if sav == 1 or len(s) - sav == 1:
	print('No')
else:
	print('Yes')


si = [e for e in input()]
test = len(set(si))
if test > 4 or test == 1:
	print('No')
elif test == 2:
	si.sort()
	if si.count(si[0]) == 1 or si.count(si[-1]) == 1:
		print('No')
	else:
		print('Yes')
elif test == 3:
	si.sort()
	if len(si) == 3:
		print('No')
	else:
		print('Yes')
else:
	print('Yes')


a = list(input())
b = [0] * 26
count = 0
for i in a:
	b[ord(i) - ord('a')] += 1
if b.count(0) < 22:
	exit(print('NO'))
if len(set(a)) == 3 and max(b) >= 2:
	exit(print('YES'))
if len(set(a)) == 4:
	exit(print('YES'))
if len(set(a)) == 2:
	for i in set(a):
		if b[ord(i) - ord('a')] < 2:
			exit(print('NO'))
		else:
			count += 1
	if count == 2:
		exit(print('YES'))
print('NO')


import collections as cl
s = list(cl.Counter(input()).values())
print(('No', 'Yes')[len(s) == 2 and s.count(1) == 0 or (len(s) == 3 and s.count(1) <= 2) or len(s) == 4])


str = input()
occs = [0] * 26
for c in str:
	occs[ord(c) - ord('a')] += 1
occs = [x for x in list(sorted(occs)) if x != 0]
if len(occs) == 1:
	print('No')
elif len(occs) == 2:
	if occs[0] > 1:
		print('Yes')
	else:
		print('No')
elif len(occs) == 3:
	if occs[2] > 1:
		print('Yes')
	else:
		print('No')
elif len(occs) == 4:
	print('Yes')
else:
	print('No')


s = input()
a = [0] * 26
for i in s:
	a[ord(i) - 97] += 1
o = []
for i in a:
	if i > 0:
		o.append(i)
if len(o) == 0:
	print('No')
elif len(o) >= 5:
	print('No')
elif len(o) == 1:
	print('No')
elif len(o) == 4:
	print('Yes')
else:
	t = len(o)
	for i in o:
		if i > 1:
			t += 1
	if t >= 4:
		print('Yes')
	else:
		print('No')


s = [ch for ch in input()]
Set = set(s)
List = list(Set)
if len(Set) == 4 or (len(Set) == 3 and len(s) > 3) or (len(Set) == 2 and s.count(List[0]) > 1 and (s.count(List[-1]) > 1)):
	print('Yes')
else:
	print('No')


def adorable(text):
	counter = {}
	for i in text:
		if i not in counter:
			counter[i] = 1
		else:
			counter[i] += 1
	n = len(counter.keys())
	if n == 1:
		return 'No'
	elif n == 2:
		if all((counter[i] >= 2 for i in counter)):
			return 'Yes'
		else:
			return 'No'
	elif n == 3:
		if any((counter[i] >= 2 for i in counter)):
			return 'Yes'
		else:
			return 'No'
	elif n == 4:
		return 'Yes'
	else:
		return 'No'
print(adorable(input()))


s = input()
(d, m, l) = (dict(), set(), list())
for i in s:
	try:
		d[i] += 1
	except:
		d[i] = 1
	m.add(i)
for i in m:
	l.append(d[i])
if len(l) == 2:
	if min(l) >= 2:
		print('Yes')
	else:
		print('No')
elif len(l) == 3:
	if l.count(1) != 3:
		print('Yes')
	else:
		print('No')
elif len(l) == 4:
	print('Yes')
else:
	print('No')


import sys
import math
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
s = str(input())
sets = set(s)
if len(sets) > 4 or len(sets) == 1:
	print('No')
elif len(sets) == 4:
	print('Yes')
elif len(sets) == 3:
	flag = 0
	for ss in sets:
		if s.count(ss) > 1:
			flag = 1
			break
	if flag:
		print('Yes')
	else:
		print('No')
elif len(sets) == 2:
	flag = 1
	for ss in sets:
		if s.count(ss) == 1:
			flag = 0
			break
	if flag:
		print('Yes')
	else:
		print('No')


import collections
import logging
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.addHandler(ch)

def solve(s):
	chars = collections.defaultdict(int)
	for c in s:
		chars[c] += 1
	if not 2 <= len(chars) <= 4:
		return False
	if len(chars) == 2 and any((chars[c] < 2 for c in chars)):
		return False
	if len(chars) == 3 and (not any((chars[c] > 1 for c in chars))):
		return False
	return True

def main():
	s = input().strip()
	result = solve(s)
	print('Yes' if result else 'No')
main()


str = input()
flag = False
d = {}
for i in str:
	d[i] = d[i] + 1 if i in d else 1
if len(d) == 4:
	flag = True
if len(d) == 3:
	for i in d:
		if d[i] > 1:
			flag = True
if len(d) == 2:
	flag = True
	for i in d:
		if d[i] == 1:
			flag = False
if flag:
	print('Yes')
else:
	print('No')


t = input()
d = {}
for i in t:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
r = []
for i in d:
	r.append(d[i])
if len(r) == 4:
	print('Yes')
elif len(r) == 3:
	if max(r) >= 2:
		print('Yes')
	else:
		print('No')
elif len(r) == 2:
	if min(r) >= 2:
		print('Yes')
	else:
		print('No')
else:
	print('No')


s = input()
mp = {}
for i in s:
	if i in mp:
		mp[i] = mp[i] + 1
	else:
		mp[i] = 1
if len(mp) > 4 or len(mp) <= 1:
	print('No')
elif len(mp) == 4:
	print('Yes')
elif len(mp) == 3:
	if max(mp.values()) >= 2:
		print('Yes')
	else:
		print('No')
elif len(mp) == 2:
	l = list(mp.values())
	if l[0] >= 2 and l[1] >= 2:
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
from collections import Counter
lst = lambda : list(map(int, stdin.readline().split()))
for _ in range(1):
	s = input()
	n = len(s)
	d = Counter(s)
	f = 1
	cnt = 0
	for (k, v) in d.items():
		if v == 1:
			cnt += 1
	if len(d) == 2 and cnt == 0:
		print('YES')
	elif 3 == len(d) and cnt <= 2:
		print('YES')
	elif len(d) == 4:
		print('YES')
	else:
		print('NO')


y = input()
x = {i: y.count(i) for i in set(y)}
l = len(x)
print('YNEOS'[(any((x[i] < 2 for i in x)) if l == 2 else len(y) < 4) if 1 < l < 5 else 1::2])


s = sorted(input())
t = 1
lets = []
for i in range(1, len(s)):
	if s[i] == s[i - 1]:
		t += 1
	else:
		lets.append(t)
		t = 1
lets.append(t)
suc = False
if len(lets) == 2 and lets[0] > 1 and (lets[1] > 1):
	suc = True
if len(lets) == 3 and max(lets) > 1:
	suc = True
if len(lets) == 4:
	suc = True
if suc:
	print('Yes')
else:
	print('No')


from collections import Counter
freq_dict = Counter(input())
if len(freq_dict) <= 1 or len(freq_dict) > 4:
	print('No')
elif len(freq_dict) == 4:
	print('Yes')
elif len(freq_dict) == 2:
	values = freq_dict.values()
	if [v for v in values if v < 2]:
		print('No')
	else:
		print('Yes')
elif sum(freq_dict.values()) == 3:
	print('No')
else:
	print('Yes')


import sys
s = input()
a = list(s)
d = {}
b = list(set(a))
if len(b) > 4 or len(b) == 1:
	print('No')
	sys.exit()
if len(b) == 4:
	print('Yes')
	sys.exit()
if len(b) == 2:
	c1 = 0
	c2 = 0
	for k in a:
		c1 += int(k == b[0])
		c2 += int(k == b[1])
	if c1 > 1 and c2 > 1:
		print('Yes')
	else:
		print('No')
else:
	c1 = 0
	c2 = 0
	c3 = 0
	for k in a:
		c1 += int(k == b[0])
		c2 += int(k == b[1])
		c3 += int(k == b[2])
	if c1 > 1 or c2 > 1 or c3 > 1:
		print('Yes')
	else:
		print('No')


X = [0] * 128
for i in input():
	X[ord(i)] += 1
(chKind, chList) = (0, [])
for i in X:
	if i:
		chKind += 1
		chList.append(i)
if chKind == 1:
	print('No')
if chKind == 2:
	if min(chList) > 1:
		print('Yes')
	else:
		print('No')
if chKind == 3:
	if max(chList) > 1:
		print('Yes')
	else:
		print('No')
if chKind == 4:
	print('Yes')
if chKind > 4:
	print('No')


a = list(input())
b = set(a)
if len(b) > 4:
	print('No')
elif len(b) == 4:
	print('Yes')
elif len(b) == 2:
	d = False
	for i in b:
		if a.count(i) <= 1:
			d = True
			break
	if d:
		print('No')
	else:
		print('Yes')
elif len(b) == 3:
	if len(a) == 3:
		print('No')
	else:
		print('Yes')
else:
	print('No')


import getpass
import sys
import math
from decimal import Decimal
import decimal
files = True
debug = False
if getpass.getuser() == 'frohenk' and files:
	debug = True
	sys.stdin = open('test.in')
elif files:
	pass

def lcm(a, b):
	return a * b // math.gcd(a, b)

def ria():
	return [int(i) for i in input().split()]

def range_sum(a, b):
	ass = (b - a + 1) // 2 * (a + b)
	if (a - b) % 2 == 0:
		ass += (b - a + 2) // 2
	return ass

def comba(n, x):
	return math.factorial(n) // math.factorial(n - x) // math.factorial(x)
mp = {}
st = input()
for i in st:
	mp[i] = 0
for i in st:
	mp[i] += 1
if len(mp) == 4:
	print('Yes')
	exit(0)
if len(mp) == 1:
	print('No')
	exit(0)
if len(mp) == 2:
	if min(mp.values()) >= 2:
		print('Yes')
		exit(0)
if len(mp) == 3:
	if max(mp.values()) >= 2:
		print('Yes')
		exit(0)
print('No')


s = input()
a = set()
for i in s:
	a.add(i)
a = list(a)
if len(a) == 4:
	print('Yes')
elif len(a) == 2:
	if s.count(a[0]) > 1 and s.count(a[1]) > 1:
		print('Yes')
	else:
		print('No')
elif len(a) == 3:
	if s.count(a[0]) > 1 or s.count(a[1]) > 1 or s.count(a[2]) > 1:
		print('Yes')
	else:
		print('No')
else:
	print('No')


s = input()
f = [0] * 26
a = 'a'
for ele in s:
	f[ord(ele) - ord(a)] += 1
se = set(s)
if len(se) == 1 or len(se) > 4:
	print('No')
	exit(0)
if len(se) == 2:
	s = list(se)
	if f[ord(s[0]) - ord(a)] > 1 and f[ord(s[1]) - ord(a)] > 1:
		print('Yes')
	else:
		print('No')
if len(se) == 3:
	if f[ord(s[0]) - ord(a)] > 1 or f[ord(s[1]) - ord(a)] > 1 or f[ord(s[2]) - ord(a)] > 1:
		print('Yes')
	else:
		print('No')
if len(se) == 4:
	print('Yes')


s = input()
z = set(s)
fl = 0
for t in z:
	if s.count(t) == 1:
		fl += 1
if len(z) == 4 or (len(z) == 2 and fl == 0) or (len(z) == 3 and fl <= len(s) - 2):
	print('Yes')
else:
	print('No')


from collections import Counter
slovo = Counter(input())
if sum(slovo.values()) < 4 or len(slovo) > 4 or len(slovo) == 1:
	print('No')
elif len(slovo) >= 3:
	print('Yes')
elif any((slovo[i] == 1 for i in slovo)):
	print('No')
else:
	print('Yes')


def ok(s):
	st = set(s)
	if not 2 <= len(st) <= 4:
		return False
	if len(st) == 2:
		return all((s.count(v) >= 2 for v in st))
	elif len(st) == 3:
		return any((s.count(v) >= 2 for v in st))
	else:
		return True
s = input()
if ok(s):
	print('Yes')
else:
	print('No')


s = input()
v1 = []
v2 = [0] * 26
ans = True
l = 0
l2 = 0
for i in s:
	if i not in v1:
		v1.append(i)
		l += 1
	if l > 4:
		ans = False
		break
	v2[ord(i) - ord('a')] += 1
	l2 += 1
if l == 1 or l2 < 4:
	ans = False
if ans and l == 2:
	for i in v1:
		if v2[ord(i) - ord('a')] < 2:
			ans = False
			break
if ans:
	print('Yes')
else:
	print('No')


import collections
import os
import sys
from io import BytesIO, IOBase
import math
ins = lambda : [int(x) for x in input()]
inp = lambda : int(input())
inps = lambda : [int(x) for x in input().split()]

def main():
	s = input()
	if len(set(s)) > 4:
		print('NO')
	else:
		dc = collections.Counter(s)
		if len(dc) < 2:
			print('NO')
			return
		if len(dc) == 2:
			for (k, v) in dc.items():
				if v < 2:
					print('NO')
					return
			print('YES')
			return
		ls = sorted(dc.values())
		if len(dc) == 3:
			if ls[-1] > 1:
				print('YES')
				return
			print('NO')
			return
		if len(dc) == 4:
			print('YES')
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import Counter
c = Counter(input())
if len(c) <= 1 or len(c) >= 5:
	print('No')
elif len(c) == 4:
	print('Yes')
elif len(c) == 2 and min(c.values()) >= 2:
	print('Yes')
elif len(c) == 3 and c.most_common(2)[0][1] >= 2:
	print('Yes')
else:
	print('No')


s = input()
l = 26 * [0]
for i in range(0, len(s)):
	l[ord(s[i]) - ord('a')] += 1
l.sort()
if l[21] > 0 or (l[23] == 0 and l[24] < 2):
	print('NO')
elif l[23] > 0 and l[22] == 0:
	if l[25] < 2:
		print('NO')
	else:
		print('YES')
else:
	print('YES')


s = input()
set_s = set(s)
yes = 0
cnt = 0
if len(set_s) == 2:
	if sum((s.count(x) > 1 for x in set_s)) == 2:
		yes = 1
elif len(set_s) == 3:
	if sum((s.count(x) > 1 for x in set_s)):
		yes = 1
elif len(set_s) == 4:
	yes = 1
print(['No', 'Yes'][yes])


s = input()
(d, lst) = ({}, [])
for (i, x) in enumerate(s):
	if d.get(x) == None:
		d[x] = 0
		lst.append(x)
	d[x] += 1
le = len(d)
if le == 1 or le > 4:
	print('No')
elif le == 2:
	if d[lst[0]] > 1 and d[lst[1]] > 1:
		print('Yes')
	else:
		print('No')
elif le == 3:
	if len(s) > 3:
		print('Yes')
	else:
		print('No')
else:
	print('Yes')


import os
import sys, math
from io import BytesIO, IOBase

def main():
	s = input()
	ct = [0 for i in range(26)]
	sett = set(s)
	for i in s:
		ct[ord(i) - ord('a')] += 1
	ct.sort()
	if (len(sett) == 4 or (ct[-1] >= 2 and len(sett) == 3)) or (len(sett) == 2 and ct[-2] >= 2):
		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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import Counter
s = Counter(input())
if sum(s.values()) < 4 or len(s) == 1 or len(s) > 4:
	print('No')
	exit()
elif len(s) >= 3:
	print('Yes')
	exit()
check = 0
for i in s:
	if s[i] == 1:
		check = 1
		break
if check == 1:
	print('No')
	exit()
else:
	print('Yes')
	exit()
exit()


import os, sys
from io import BytesIO, IOBase

def main():
	s = rstr()
	(dis, mem) = ([], [0] * 26)
	for i in range(len(s)):
		ix = ord(s[i]) - 97
		mem[ix] += 1
		if mem[ix] == 1:
			dis.append(ix)
	if len(dis) == 4 or (len(dis) == 3 and any([mem[i] > 1 for i in dis])) or (len(dis) == 2 and all([mem[x] > 1 for x in dis])):
		print('yes')
	else:
		print('no')

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')
BUFSIZE = 8192
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
rstr = lambda : input().strip()
rstrs = lambda : [str(x) for x in input().split()]
rstr_2d = lambda n: [rstr() for _ in range(n)]
rint = lambda : int(input())
rints = lambda : [int(x) for x in input().split()]
rint_2d = lambda n: [rint() for _ in range(n)]
rints_2d = lambda n: [rints() for _ in range(n)]
ceil1 = lambda a, b: (a + b - 1) // b
main()


s = input()
dict = {}
for i in range(len(s)):
	if s[i] not in dict.keys():
		dict[s[i]] = 1
	else:
		dict[s[i]] += 1
if len(s) == 1:
	print('No')
elif len(dict) == 1:
	print('No')
elif len(dict) == 2:
	k = 1
	for i in dict:
		if dict[i] == 1:
			k = 0
	if k == 1:
		print('Yes')
	else:
		print('No')
elif len(dict) == 3:
	if len(s) > 3:
		print('Yes')
	else:
		print('No')
elif len(dict) == 4:
	print('Yes')
else:
	print('No')


from collections import Counter
s = input()
ln = len(set(s))
C = Counter(s)
if ln == 1 or ln > 4:
	print('No')
elif ln == 2:
	print(('No', 'Yes')[min(C.values()) >= 2])
elif ln == 3:
	print(('No', 'Yes')[max(C.values()) >= 2])
elif ln == 4:
	print('Yes')
else:
	exit(100500)


from collections import *
s = Counter(input())
l = len(s)
print(['No', 'Yes'][1 < l < 5 and len([x for x in s.values() if x > 1]) > 3 - l])


import math as ma
from sys import exit

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

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

def nu():
	return int(input())
s = input()
f = [0] * 26
for ch in s:
	f[ord(ch) - 97] += 1
c = 0
x = []
v = []
for i in range(26):
	if f[i] > 0:
		c += 1
		x.append(i)
		v.append(f[i])
xx = sorted(zip(v, x))
if c == 1:
	print('No')
	exit()
if c % 2 == 0:
	if c == 2 and xx[0][0] != 1 or c == 4:
		print('Yes')
	else:
		print('No')
elif c == 3:
	if xx[0][0] == 1 and xx[1][0] == 1 and (xx[2][0] == 1):
		print('No')
	else:
		print('Yes')
else:
	print('No')


string = input()
a = [0 for i in range(26)]
for i in range(len(string)):
	a[ord(string[i]) - 97] += 1
cnt = 0
for i in range(26):
	if a[i] > 0:
		cnt += 1
if cnt > 4:
	print('No')
elif cnt == 4:
	print('Yes')
elif cnt == 3:
	flag = False
	for i in range(26):
		if a[i] > 1:
			flag = True
			break
	if flag:
		print('Yes')
	else:
		print('No')
elif cnt == 1:
	print('No')
else:
	flag = True
	for i in range(26):
		if a[i] == 1:
			flag = False
			break
	if flag:
		print('Yes')
	else:
		print('No')


s = input()
t = set(s)
l = len(t)
print(['No', 'Yes'][1 < l < 5 and l + sum((s.count(x) > 1 for x in t)) > 3])


from collections import Counter
d = Counter(input())
if sum(d.values()) < 4 or len(d) > 4 or len(d) == 1:
	print('No')
elif len(d) >= 3:
	print('Yes')
elif any((d[k] == 1 for k in d)):
	print('No')
else:
	print('Yes')


answer = 'Yes'
s = input()
if len(s) <= 3:
	answer = 'No'
sett = set(s)
len_of_differents = len(sett)
if len_of_differents < 2 or len_of_differents > 4:
	answer = 'No'
if len_of_differents == 2:
	for char in sett:
		if s.count(char) < 2:
			answer = 'No'
print(answer)


string = input()
s = set(string)
len1 = len(s)
if len1 <= 1 or len1 > 4:
	print('NO')
	exit(0)
len2 = len(string)
if len2 < 4:
	print('NO')
	exit(0)
num = 0
if len1 == 2:
	line = string[0]
	for i in range(len2):
		if string[i] is line:
			num = num + 1
	if num + 1 == len2:
		print('NO')
		exit(0)
	elif num == 1:
		print('NO')
		exit(0)
print('YES')


s = input()
es1 = ''
es2 = ''
if len(s) < 4:
	print('No')
	exit(0)
else:
	a = list(set(s))
	a.sort()
	b = len(a)
	if b > 4:
		print('No')
		exit(0)
	elif b == 3 or b == 4:
		print('Yes')
	elif b == 1:
		print('No')
	else:
		for i in a:
			if s.count(i) == 1:
				print('No')
				exit()
		print('Yes')


def solve(s):
	d = len(set(s))
	if len(s) < 4:
		return 'NO'
	elif d > 4:
		return 'NO'
	elif d == 4:
		return 'YES'
	elif d == 3:
		return 'YES'
	elif d == 2:
		letters = set(s)
		for y in letters:
			if s.count(y) == 1:
				return 'NO'
		else:
			return 'YES'
	elif d == 1:
		return 'NO'
s = input()
print(solve(s))


s = input()
if len(set(s)) == 1:
	print('No')
elif len(set(s)) == 2:
	if s.count(list(set(s))[0]) > 1 and s.count(list(set(s))[1]) > 1:
		print('Yes')
	else:
		print('No')
elif len(set(s)) == 3:
	if any((s.count(x) > 1 for x in set(s))):
		print('Yes')
	else:
		print('No')
elif len(set(s)) == 4:
	print('Yes')
else:
	print('No')


s = input()
if len(s) < 4:
	print('No')
else:
	d = 0
	c = 0
	a = [0] * 26
	for i in s:
		if a[ord(i) - ord('a')] == 0:
			d += 1
		a[ord(i) - ord('a')] += 1
	if d == 4 or d == 3 or (d == 2 and 1 not in a):
		c = 1
	if c == 0:
		print('No')
	else:
		print('Yes')


a = input()
b = list(set(a))
if len(b) == 1 or len(b) >= 5:
	print('NO')
elif len(b) == 2:
	c1 = a.count(b[0])
	c2 = a.count(b[1])
	if c1 >= 2 and c2 >= 2:
		print('YES')
	else:
		print('NO')
elif len(b) == 3:
	c1 = a.count(b[0])
	c2 = a.count(b[1])
	c3 = a.count(b[2])
	if c1 == 1 and c2 == 1 and (c3 == 1):
		print('NO')
	else:
		print('YES')
else:
	print('YES')


s = input()
a = set(s)
l = len(a)
c = lambda x: s.count(x) > 1
print('Yes' if l == 2 and all(map(c, a)) or (l == 3 and any(map(c, a))) or l == 4 else 'No')


s = input()
ans = 'No'
if len(s) > 3:
	letern = 1
	leters = [s[0]]
	letersc = [0]
	for l in s:
		f = 0
		for i in range(0, letern):
			if leters[i] == l:
				letersc[i] += 1
				f = 1
		if f == 0:
			letern += 1
			leters.append(l)
			letersc.append(1)
	if letern == 4:
		ans = 'Yes'
	if letern == 3:
		ans = 'Yes'
	if letern == 2:
		f = 0
		for c in letersc:
			if c == 1:
				f = 1
		if f != 1:
			ans = 'Yes'
print(ans)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	s = list(inp())
	n = len(s)
	dis = len(set(s))
	if n < 4:
		print('No')
		return
	if n == 1:
		print('No')
		return
	if dis == 1:
		print('NO')
	elif dis == 2:
		temp = list(set(s))
		if s.count(temp[0]) == 1 or s.count(temp[1]) == 1:
			print('No')
		else:
			print('Yes')
	elif dis == 3:
		print('Yes')
	elif dis == 4:
		print('Yes')
	else:
		print('No')
testcase(1)


s = input()
if len(s) < 4:
	print('No')
else:
	a = {}
	for i in s:
		if i in a:
			a[i] += 1
		else:
			a[i] = 1
	x = 0
	for i in a:
		if a[i] > 1:
			x += 1
	if (x >= 2 or len(a) > 2) and len(a) < 5:
		print('Yes')
	else:
		print('No')


a = [0] * 27
x = input()
for i in x:
	a[ord(i) - 96] += 1
s = 0
q = 0
for i in a:
	if i != 0:
		s += 1
	if i > 1:
		q += 1
if s > 4:
	print('No')
elif s <= 1:
	print('No')
elif s == 4:
	print('Yes')
elif s == 2:
	if q >= 2:
		print('Yes')
	else:
		print('No')
elif q >= 1:
	print('Yes')
else:
	print('No')


(s, m) = (set(), set())
b = 0
for i in input():
	if i not in s:
		s.add(i)
	else:
		m.add(i)
	if len(s) > 4:
		print('No')
		quit()
	elif len(s) + len(m) >= 4:
		b = 1
if b:
	print('Yes')
else:
	print('No')


x = input()
if len(set(x)) > 4 or len(x) < 4:
	print('No')
	exit
else:
	if len(set(x)) == 1:
		print('No')
	if len(set(x)) == 2:
		if all((x.count(i) >= 2 for i in set(x))):
			print('Yes')
		else:
			print('No')
	if len(set(x)) == 3 or len(set(x)) == 4:
		print('Yes')


s = input()
seta = set(s)
if len(s) < 4:
	print('No')
elif len(seta) == 2:
	ans = 'Yes'
	for i in seta:
		if s.count(i) == 1:
			ans = 'No'
			break
	print(ans)
elif len(seta) in [3, 4]:
	print('Yes')
else:
	print('No')


s = input()
l = list(set(s))
ans = 1
if len(l) > 4 or len(l) <= 1:
	ans = 0
else:
	if len(l) == 2:
		c1 = 0
		c0 = 0
		for i in range(len(s)):
			if s[i] == l[0]:
				c0 += 1
			else:
				c1 += 1
		if c1 < 2 or c0 < 2:
			ans = 0
	if len(l) == 3:
		c1 = 0
		c2 = 0
		c0 = 0
		for i in range(len(s)):
			if s[i] == l[0]:
				c0 += 1
			if s[i] == l[1]:
				c1 += 1
			if s[i] == l[2]:
				c2 += 1
		if c1 + c2 + c0 < 4:
			ans = 0
if ans == 0:
	print('No')
else:
	print('Yes')


s = input()
set0 = set()
arr = []
for i in s:
	set0.add(i)
set0 = list(set0)
for i in set0:
	arr.append(s.count(i))
if len(set0) > 4 or len(set0) == 1:
	print('No')
elif len(set0) == 2 and 1 in arr:
	print('No')
elif len(set0) == 3 and arr.count(1) == 3:
	print('No')
else:
	print('Yes')


from collections import Counter

def no():
	print('No')
	exit(0)
s = input()
if len(s) < 4:
	no()
cnt = Counter(s)
cnt = list(cnt.items())
if len(cnt) < 2 or len(cnt) > 4:
	no()
if len(cnt) == 2 and (cnt[0][1] == 1 or cnt[1][1] == 1):
	no()
if len(cnt) == 3 and max(cnt[0][1], cnt[1][1], cnt[2][1]) == 1:
	no()
print('Yes')


from collections import Counter
cnt = Counter(input().strip())
vals = sorted(cnt.values())
if len(vals) == 1 or len(vals) > 4:
	print('No')
elif len(vals) == 2:
	(a, b) = vals
	if a == 1:
		print('No')
	else:
		print('Yes')
elif len(vals) == 3:
	(a, b, c) = vals
	if c == 1:
		print('No')
	else:
		print('Yes')
elif len(vals) == 4:
	print('Yes')
else:
	raise RuntimeError('Should never happen')


s = input()
have_chars = set()
chars = {}
for c in s:
	have_chars.add(c)
	if c not in chars.keys():
		chars[c] = 1
	else:
		chars[c] += 1
if len(have_chars) <= 1 or len(have_chars) > 4:
	print('NO')
	exit(0)
if len(s) <= 3:
	print('NO')
	exit(0)
if len(have_chars) == 2 and min(chars.values()) < 2:
	print('NO')
	exit(0)
print('YES')


s = input()
from collections import Counter
d = Counter(s)
if len(d) > 4:
	print('No')
	exit(0)
l = (4 - len(d) % 4) % 4
p = 0
for x in d:
	if d[x] >= 2:
		p += 1
if p >= l:
	print('Yes')
else:
	print('No')


s = list(input())
a = [0] * 26
for i in s:
	a[ord(i) - ord('a')] += 1
aa = [x for x in a if x > 0]
if len(aa) == 2:
	if aa[0] >= 2 and aa[1] >= 2:
		print('Yes')
		exit()
if len(aa) == 3:
	if sum(aa) >= 4:
		print('Yes')
		exit()
if len(aa) == 4:
	print('Yes')
	exit()
print('No')
exit()


import sys
import bisect
s = input()
hashi = dict()
for i in s:
	if i in hashi:
		hashi[i] += 1
	else:
		hashi[i] = 1
z = len(hashi)
if len(s) < 4:
	print('No')
	quit()
if z > 4:
	print('No')
	quit()
if z == 1:
	print('No')
	quit()
rem = 0
for i in hashi:
	if hashi[i] > 1:
		rem += 1
if rem + z >= 4:
	print('Yes')
else:
	print('No')


from collections import Counter
s = Counter(input())
f = 0
for (i, j) in s.items():
	if j > 1:
		f += 1
if ((len(s) % 2 == 0 or (len(s) % 2 != 0 and f >= 1)) and len(s) > 2 or (len(s) == 2 and f == 2)) and len(s) <= 4:
	print('Yes')
else:
	print('No')


s = input()
r = set(s)
if len(r) >= 5 or len(r) <= 1:
	print('No')
if len(r) == 4:
	print('Yes')
if len(r) == 3:
	if len(s) > 3:
		print('Yes')
	else:
		print('No')
if len(r) == 2:
	d = dict()
	f = 1
	for i in s:
		if d.get(i) == None:
			d[i] = 1
		else:
			d[i] += 1
	for i in s:
		if d[i] == 1:
			f = 0
	if f:
		print('Yes')
	else:
		print('No')


a = input()
b = set()
for i in a:
	b.add(i)
l = len(b)
if l == 2:
	b = {}
	l = 0
	for i in a:
		if i in b:
			b[i] += 1
		else:
			b[i] = 1
	for i in b:
		if b[i] > 1:
			l = l + 1
	if l == 2:
		print('YES')
	else:
		print('NO')
elif l >= 3 and l <= 4:
	if l == 4:
		print('YES')
	else:
		b = {}
		for i in a:
			if i in b:
				b[i] += 1
			else:
				b[i] = 1
		l = 0
		for i in b:
			if b[i] > 1:
				l = l + 1
		if l >= 1:
			print('YES')
		else:
			print('NO')
else:
	print('NO')


s = input()
k = len(set(s))
ss = list(set(s))
ans = 'NO'
if k == 4 or (k == 3 and len(s) != 3) or (k == 2 and s.count(ss[0]) != 1 and (s.count(ss[1]) != 1)):
	ans = 'YES'
print(ans)


s = input()
cnt = [0 for i in range(26)]
for c in s:
	cnt[ord(c) - ord('a')] += 1
cnt1 = 0
cnt2 = 0
for i in range(26):
	if cnt[i] > 0:
		cnt1 += 1
	if cnt[i] > 1:
		cnt2 += 1
if cnt1 > 4 or cnt1 < 2:
	print('No')
elif cnt1 == 2:
	if cnt2 < 2:
		print('No')
	else:
		print('Yes')
elif cnt1 == 3:
	if len(s) > 3:
		print('Yes')
	else:
		print('No')
else:
	print('Yes')


R = lambda : map(int, input().split())
s = str(input())
dyn = [0] * 26
app = [False] * 26
for i in range(len(s)):
	dyn[ord(s[i]) - ord('a')] += 1
	app[ord(s[i]) - ord('a')] = True
t = sum(app)
if t == 1 or t > 4:
	print('No')
if t == 2:
	if 1 not in dyn:
		print('Yes')
	else:
		print('No')
if t == 3:
	if max(dyn) > 1:
		print('Yes')
	else:
		print('No')
if t == 4:
	print('Yes')


n = input()
if len(n) < 4:
	print('No')
else:
	l = []
	for i in n:
		if i not in l:
			l += [i]
	d = len(l)
	if d > 4:
		print('No')
	elif d == 4:
		print('Yes')
	elif d == 3 and len(n) >= 4:
		print('Yes')
	elif d == 1:
		print('No')
	elif d == 2:
		a = l[0]
		b = l[1]
		if n.count(a) >= 2 and n.count(b) >= 2:
			print('Yes')
		else:
			print('No')


s = input()
se = len(set(s))
possible = False
if se > 4:
	possible = False
elif se is 4:
	possible = True
elif se is 3:
	if len(s) >= 4:
		possible = True
	else:
		possible = False
elif se is 2:
	f1 = 0
	f2 = 0
	c = s[0]
	for c1 in s:
		if c1 == c:
			f1 += 1
		else:
			f2 += 1
	if f1 >= 2 and f2 >= 2:
		possible = True
	else:
		possible = False
if possible:
	print('Yes')
else:
	print('No')


s = input()
d = set(s)
k = sorted(d)
if len(s) < 4 or len(d) == 1 or (len(d) == 2 and (s.count(k[0]) == 1 or s.count(k[1]) == 1)):
	print('No')
elif len(d) <= 4:
	print('Yes')
else:
	print('No')


s = input()
a = list(set(s))
l = len(a)
print('Yes' if l == 2 and all((s.count(a[i]) > 1 for i in [0, 1])) or (l == 3 and any((s.count(a[i]) > 1 for i in range(3)))) or l == 4 else 'No')


import sys
from collections import defaultdict
s = list(input().strip())
n = len(s)
if n < 4:
	print('No')
	sys.exit(0)
count = defaultdict(int)
for x in s:
	count[x] += 1
n = len(count)
if n == 1 or n > 4:
	res = 'No'
elif n == 4:
	res = 'Yes'
elif n == 3:
	res = 'No'
	for x in count.values():
		if x >= 2:
			res = 'Yes'
else:
	res = 'Yes'
	for x in count.values():
		if x < 2:
			res = 'No'
print(res)


from collections import Counter
s = input().strip()
counter = Counter(s)
nchar = len(counter)
ans = 'No'
if nchar == 4 or (nchar == 3 and any([n > 1 for (ch, n) in counter.items()])) or (nchar == 2 and all([n > 1 for (ch, n) in counter.items()])):
	ans = 'Yes'
print(ans)


s = input()
ss = set(s)
if len(s) >= 4:
	if len(ss) in (3, 4):
		print('Yes')
	elif len(ss) == 2:
		for c in ss:
			if s.count(c) == 1:
				print('No')
				break
		else:
			print('Yes')
	else:
		print('No')
else:
	print('No')


test_str = input()
mmap = {}
for c in test_str:
	if c in mmap.keys():
		mmap[c] = mmap[c] + 1
	else:
		mmap[c] = 1
num = len(mmap.keys())
if num > 4 or num <= 1:
	print('No')
elif num == 2:
	for (key, value) in mmap.items():
		if value < 2:
			print('No')
			exit()
	print('Yes')
elif num == 3:
	if sum(mmap.values()) < 4:
		print('No')
	else:
		print('Yes')
else:
	print('Yes')


from collections import defaultdict
string = input()

def can_split_into_two_adorable():
	letters_count = defaultdict(lambda : 0)
	for i in string:
		letters_count[i] += 1
	if len(letters_count) > 4 or len(letters_count) == 1:
		return False
	if len(letters_count) == 2:
		for i in letters_count.values():
			if i < 2:
				return False
	if len(letters_count) == 3 and sum(letters_count.values()) == 3:
		return False
	return True
if can_split_into_two_adorable():
	print('YES')
else:
	print('NO')


from collections import Counter

def has_beautiful_splits(s):
	counter = Counter(s)
	if len(counter) == 4:
		return True
	elif len(counter) == 3:
		return max(counter.values()) > 1
	elif len(counter) == 2:
		return min(counter.values()) > 1
	return False
s = input()
print('Yes' if has_beautiful_splits(s) else 'No')


import sys, math
s = input()
if len(set(list(s))) == 1 or len(set(list(s))) > 4:
	print('NO')
elif len(set(list(s))) == 4:
	print('YES')
elif len(set(list(s))) == 3:
	if len(s) > 3:
		print('YES')
	else:
		print('NO')
elif len(set(list(s))) == 2:
	a = [0] * 26
	for i in range(len(s)):
		a[ord(s[i]) - 97] += 1
	a.sort(reverse=True)
	if a[0] > 1 and a[1] > 1:
		print('YES')
	else:
		print('NO')


s = str(input())
from collections import Counter
C = Counter(s)
C = list(C.values())
C.sort(reverse=True)
if len(C) == 1:
	print('No')
elif len(C) == 2:
	if C[0] >= 2 and C[1] >= 2:
		print('Yes')
	else:
		print('No')
elif len(C) == 3:
	if C[0] >= 2:
		print('Yes')
	else:
		print('No')
elif len(C) == 4:
	print('Yes')
else:
	print('No')


s = input()
se = set(s)
check = 0
c3 = 0
d = list(s)
if len(se) == 1:
	print('No')
elif len(se) < 5:
	if len(se) == 2:
		for i in se:
			c1 = d.count(i)
			if c1 == 1:
				check = 1
				print('No')
				break
		if check == 0:
			print('Yes')
	elif len(se) == 3:
		for i in se:
			c1 = d.count(i)
			if c1 == 1:
				c3 += 1
		if c3 == 3:
			print('No')
		else:
			print('Yes')
	else:
		print('Yes')
else:
	print('No')


def go(s):
	d = {}
	for c in s:
		d[c] = d.get(c, 0) + 1
	if len(d.keys()) > 4 or len(d.keys()) == 1:
		return 'No'
	if len(d.keys()) == 2:
		if 1 in d.values():
			return 'No'
		else:
			return 'Yes'
	if len(d.keys()) == 3:
		if sum(d.values()) > 3:
			return 'Yes'
		else:
			return 'No'
	else:
		return 'Yes'
s = list(input())
print(go(s))


s = input()
if len(s) < 4:
	print('No')
	exit(0)
st = {}
used = {}
for i in s:
	st[i] = st.get(i, 0) + 1
	used[i] = 0
if 2 <= len(st) <= 4:
	if len(st) > 2:
		print('YES')
	else:
		cnt = 0
		for i in st:
			if st[i] < 2:
				print('No')
				exit(0)
		print('Yes')
else:
	print('No')


s = input()
from collections import Counter

def adorable(s):
	if len(set(s)) == 1:
		return 'No'
	if len(s) < 4:
		return 'No'
	if len(set(s)) > 4:
		return 'No'
	if len(set(s)) == 2:
		d = Counter(s)
		for i in d:
			if d[i] == 1:
				return 'No'
	return 'Yes'
print(adorable(s))


def main():
	string = input()
	letters = {}
	for i in string:
		if i in letters:
			letters[i] += 1
		elif len(letters) == 4:
			print('No')
			return
		else:
			letters[i] = 1
	if len(letters) == 4:
		print('Yes')
	elif len(letters) == 3:
		for i in letters.keys():
			if letters[i] > 1:
				print('Yes')
				return
		print('No')
		return
	elif len(letters) == 2:
		keys = list(letters.keys())
		if letters[keys[0]] > 1 and letters[keys[1]] > 1:
			print('Yes')
			return
		else:
			print('No')
			return
	else:
		print('No')
		return
main()


import sys
d = dict()
raw = input()
for a in raw:
	if a in d:
		d[a] += 1
	else:
		d[a] = 1
	if len(d) > 4:
		print('No')
		sys.exit(0)
if len(d) == 4:
	print('Yes')
elif len(d) == 3:
	for k in d:
		if d[k] > 1:
			print('Yes')
			sys.exit(0)
	print('No')
elif len(d) == 2:
	for k in d:
		if d[k] < 2:
			print('No')
			sys.exit(0)
	print('Yes')
elif len(d) == 1:
	print('No')


s = input()
d = {}
for i in s:
	if d.get(i):
		d[i] += 1
	else:
		d[i] = 1
if len(d) > 4 or len(d) < 2:
	print('No')
elif len(d) == 2:
	exist = True
	for i in d.values():
		if i < 2:
			exist = False
	if exist:
		print('Yes')
	else:
		print('No')
elif len(d) == 3:
	exist = False
	for i in d.values():
		if i >= 2:
			exist = True
	if exist:
		print('Yes')
	else:
		print('No')
else:
	print('Yes')


R = lambda : map(int, input().split())
s = input()
from collections import Counter
c = Counter(s)
if len(c) > 4 or len(c) < 2:
	print('No')
	exit()
if len(c) == 4:
	print('Yes')
	exit()
if len(c) == 3 and max(c.values()) > 1:
	print('Yes')
	exit()
if len(c) == 2 and min(c.values()) > 1:
	print('Yes')
	exit()
print('No')


def main():
	dist = {}
	s = input()
	for i in s:
		if i not in dist.keys():
			dist[i] = 1
		else:
			dist[i] += 1
	if len(dist) > 4:
		print('No')
		return
	if len(dist) == 4:
		print('Yes')
		return
	if len(dist) == 3:
		found = False
		for i in dist.keys():
			if dist[i] > 1:
				found = True
		if not found:
			print('No')
			return
		print('Yes')
		return
	if len(dist) == 2:
		for i in dist.keys():
			if dist[i] == 1:
				print('No')
				return
		print('Yes')
		return
	print('No')
main()


s = input()
a = [0] * 26
b = [0] * 26
for i in s:
	a[ord(i) - ord('a')] += 1
	b[ord(i) - ord('a')] = 1
if sum(b) == 4:
	print('Yes')
elif sum(b) >= 2:
	num = 0
	for i in range(26):
		if b[i] == 1 and a[i] >= 2:
			num += 1
	if sum(b) == 2 and num >= 2:
		print('Yes')
	elif sum(b) == 3 and num >= 1:
		print('Yes')
	else:
		print('No')
else:
	print('No')


from collections import defaultdict
s = list(input())
dic = defaultdict(int)
for i in s:
	dic[i] += 1
if len(dic) > 4:
	print('No')
elif len(dic) == 3:
	if len(s) == 3:
		print('No')
	else:
		print('Yes')
elif len(dic) == 4:
	print('Yes')
elif len(dic) == 2:
	if min(dic.values()) >= 2:
		print('Yes')
	else:
		print('No')
else:
	print('No')


s = input()
d = len(set(s))
from collections import Counter
c = Counter(s)
if len(s) < 4:
	print('No')
elif d > 4:
	print('No')
elif d == 4:
	print('Yes')
elif d == 3:
	print('Yes')
elif d == 2:
	for i in c:
		if c[i] == 1:
			print('No')
			break
	else:
		print('Yes')
else:
	print('No')


s = list(input())
arr = [0] * 26
for i in range(len(s)):
	arr[ord(s[i]) - ord('a')] += 1
ones = 0
mul = 0
for i in range(len(arr)):
	if arr[i] == 1:
		ones += 1
	elif arr[i] > 1:
		mul += 1
if ones + mul > 4:
	print('No')
elif ones + mul == 4:
	print('Yes')
elif ones + mul == 3:
	if mul:
		print('Yes')
	else:
		print('No')
elif ones + mul == 2:
	if ones:
		print('No')
	else:
		print('Yes')
else:
	print('No')


from collections import Counter
s = input().strip()
counter = Counter(s)
if len(s) < 4:
	print('No')
elif len(counter) == 1:
	print('No')
elif len(counter) > 4:
	print('No')
elif len(counter) >= 3:
	print('Yes')
elif len(counter) == 2:
	if min(counter.values()) > 1:
		print('Yes')
	else:
		print('No')


a = input()
b = set(a)
if len(b) > 4:
	print('NO')
	exit(0)
if len(b) == 4:
	print('YES')
elif len(b) < 2:
	print('NO')
elif len(b) == 3:
	if len(a) >= 4:
		print('YES')
	else:
		print('NO')
elif len(b) == 2:
	c = ''
	for i in b:
		c += i
	if a.count(c[0]) >= 2 and a.count(c[1]) >= 2:
		print('YES')
	else:
		print('NO')


ab = 'abcdefghijklmnopqrstuvwxyz'
ab_ = [0] * 26
string = str(input())
if len(string) < 4:
	print('No')
	exit(0)
k = 0
for i in range(len(string)):
	for j in range(26):
		if string[i] == ab[j]:
			ab_[j] += 1
for i in range(26):
	if ab_[i] > 0:
		k += 1
if k > 4:
	print('No')
	exit(0)
if k == 1:
	print('No')
	exit(0)
if k == 2:
	for i in range(26):
		if ab_[i] == 1:
			print('No')
			exit(0)
print('Yes')


s = list(input().strip())
h = [0] * 26
for e in s:
	x = ord(e) - ord('a')
	h[x] += 1
cnt = 0
for e in h:
	if e > 0:
		cnt += 1
if cnt > 4 or cnt == 1:
	print('No')
elif cnt == 4:
	print('Yes')
elif cnt == 3:
	if max(h) > 1:
		print('Yes')
	else:
		print('No')
elif cnt == 2:
	h.sort(reverse=True)
	if h[1] > 1:
		print('Yes')
	else:
		print('No')


s = input()
u = set(s)
l = len(u)
c = [s.count(x) > 1 for x in u]
if l is 4 or (l is 3 and any(c)) or (l is 2 and all(c)):
	print('Yes')
else:
	print('No')


def fu():
	n = input()
	di = {}
	s = set()
	s2 = []
	for i in n:
		if i not in di:
			di[i] = 1
		else:
			di[i] = di[i] + 1
		s.add(i)
	if len(s) > 4:
		print('NO')
		return
	for i in di:
		s2.append(di[i])
	if len(s) == 1:
		print('NO')
		return
	if len(s) == 2:
		if 1 in s2:
			print('NO')
			return
	if len(s) == 3:
		for j in s2:
			if j > 1:
				print('YES')
				return
		print('NO')
		return
	print('YES')
fu()


from functools import reduce
s = input()
num_of_chars_in_s = {}
for char in s:
	if char not in num_of_chars_in_s:
		num_of_chars_in_s[char] = 0
	num_of_chars_in_s[char] += 1
answer = False
if len(num_of_chars_in_s) < 2 or len(num_of_chars_in_s) > 4:
	pass
elif len(num_of_chars_in_s) == 2:
	answer = reduce(lambda x, y: x and y, [num > 1 for (_, num) in num_of_chars_in_s.items()])
elif len(num_of_chars_in_s) == 3:
	answer = reduce(lambda x, y: x or y, [num > 1 for (_, num) in num_of_chars_in_s.items()])
elif len(num_of_chars_in_s) == 4:
	answer = reduce(lambda x, y: x or y, [num >= 1 for (_, num) in num_of_chars_in_s.items()])
print('Yes' if answer else 'No')


s = input()
m = {}
for i in s:
	if i in m:
		m[i] += 1
	else:
		m[i] = 1
sz = len(m)
ans = False
if sz == 4:
	ans = True
if sz == 3:
	mx = 0
	for i in m:
		mx = max(m[i], mx)
	if mx >= 2:
		ans = True
if sz == 2:
	mn = 5
	for i in m:
		mn = min(mn, m[i])
	if mn >= 2:
		ans = True
print('Yes' if ans else 'No')


s = list(input())
c = {}
for e in s:
	if e not in c:
		c[e] = 1
	else:
		c[e] += 1
tam = len(c)
flag = True
if tam <= 1 or tam >= 5:
	flag = False
elif tam == 2:
	for e in c:
		if c[e] <= 1:
			flag = False
			break
elif tam == 3:
	flag = False
	for e in c:
		if c[e] >= 2:
			flag = True
			break
if flag:
	print('Yes')
else:
	print('No')


TN = 1

def solution():
	s = input()
	l = list(s)
	st = set(l)
	st = list(st)
	ans = 'Yes'
	m_s = len(st)
	if m_s > 4 or m_s == 1:
		ans = 'No'
	elif m_s == 2:
		if l.count(st[0]) == 1 or l.count(st[1]) == 1:
			ans = 'No'
	elif m_s == 3:
		if (l.count(st[0]) == 1 or l.count(st[1]) == 1 or l.count(st[2]) == 1) and (not (l.count(st[0]) > 1 or l.count(st[1]) > 1 or l.count(st[2]) > 1)):
			ans = 'No'
	print(ans)
while TN != 0:
	solution()
	TN -= 1