s=input().count;print(('YNEOS'[sum(abs(s(x)-s(y))<2for x,y in['ab','bc','ca'])<3::2]))
s=eval(input());c=[s.count(t)for t in 'abc'];print(('YNEOS'[max(c)-min(c)>1::2]))
s = input().count
print(("YNEOS"[sum(abs(s(x) - s(y)) < 2 for x, y in ["ab", "bc", "ca"]) < 3 :: 2]))

s = eval(input())
c = [s.count(t) for t in "abc"]
print(("YNEOS"[max(c) - min(c) > 1 :: 2]))

-s = input().count -print(("YNEOS"[sum(abs(s(x) - s(y)) < 2 for x, y in ["ab", "bc", "ca"]) < 3 :: 2])) +s = eval(input()) +c = [s.count(t) for t in "abc"] +print(("YNEOS"[max(c) - min(c) > 1 :: 2]))