import sys from collections import defaultdict try: s = input() n = len(s) except ValueError: print("NO") sys.exit() if n < 2: print("NO") sys.exit() d = defaultdict(list) for i in range(n): if s[i] != " ": d[s[i]].append(i) ok = False if len(d) == 0: print("NO") sys.exit() for v in d.values(): l = len(v) tmp = True for i in range(l-1): if v[i+1] - v[i] != 2: tmp = False if tmp: ok = True if ok: print("Yes") else: print("NO")