S = input().strip()

N = len(S)

C = {"a":0,"b":0,"c":0}

for i in range(N):

    C[S[i]] += 1

na = C["a"]

nb = C["b"]

nc = C["c"]

if max(na,nb,nc)-min(na,nb,nc)<=1:

    print("YES")

else:

    print("NO")
S = input().strip()

if len(S)==1:

    print("YES")

elif len(S)==2:

    if S[0]!=S[1]:

        print("YES")

    else:

        print("NO")

elif len(S)==3:

    if S[0]!=S[1] and S[1]!=S[2] and S[2]!=S[0]:

        print("YES")

    else:

        print("NO")

else:

    C = {"a":0,"b":0,"c":0}

    for i in range(len(S)):

        C[S[i]] += 1

    if len(S)%3==0:

        if C["a"]==C["b"]==C["c"]:

            print("YES")

        else:

            print("NO")

    else:

        if max(C["a"],C["b"],C["c"])==len(S)//3+1 and min(C["a"],C["b"],C["c"])==len(S)//3:

            print("YES")

        else:

            print("NO")

        
S = input().strip()
N = len(S)
C = {"a": 0, "b": 0, "c": 0}
for i in range(N):
    C[S[i]] += 1
na = C["a"]
nb = C["b"]
nc = C["c"]
if max(na, nb, nc) - min(na, nb, nc) <= 1:
    print("YES")
else:
    print("NO")

S = input().strip()
if len(S) == 1:
    print("YES")
elif len(S) == 2:
    if S[0] != S[1]:
        print("YES")
    else:
        print("NO")
elif len(S) == 3:
    if S[0] != S[1] and S[1] != S[2] and S[2] != S[0]:
        print("YES")
    else:
        print("NO")
else:
    C = {"a": 0, "b": 0, "c": 0}
    for i in range(len(S)):
        C[S[i]] += 1
    if len(S) % 3 == 0:
        if C["a"] == C["b"] == C["c"]:
            print("YES")
        else:
            print("NO")
    else:
        if (
            max(C["a"], C["b"], C["c"]) == len(S) // 3 + 1
            and min(C["a"], C["b"], C["c"]) == len(S) // 3
        ):
            print("YES")
        else:
            print("NO")

-N = len(S) -C = {"a": 0, "b": 0, "c": 0} -for i in range(N): -    C[S[i]] += 1 -na = C["a"] -nb = C["b"] -nc = C["c"] -if max(na, nb, nc) - min(na, nb, nc) <= 1: +if len(S) == 1: +elif len(S) == 2: +    if S[0] != S[1]: +        print("YES") +    else: +        print("NO") +elif len(S) == 3: +    if S[0] != S[1] and S[1] != S[2] and S[2] != S[0]: +        print("YES") +    else: +        print("NO") -    print("NO") +    C = {"a": 0, "b": 0, "c": 0} +    for i in range(len(S)): +        C[S[i]] += 1 +    if len(S) % 3 == 0: +        if C["a"] == C["b"] == C["c"]: +            print("YES") +        else: +            print("NO") +    else: +        if ( +            max(C["a"], C["b"], C["c"]) == len(S) // 3 + 1 +            and min(C["a"], C["b"], C["c"]) == len(S) // 3 +        ): +            print("YES") +        else: +            print("NO")