import sys S=list(input()) A=[set() for i in range(26)] x=S[0] y=S[-1] for i in range(len(S)): if S[i]==x or S[i]==y: S[i]=" " for i in range(len(S)): if S[i]==" ": continue A[ord(S[i])-97].add(i%2) if len(S)<=2: print("NO") sys.exit() for a in A: if len(a)==1: print("Yes") break else: print("NO")