import sys from collections import defaultdict s = input() n = len(s) 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 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")