def main(): import sys input = sys.stdin.readline S = input().rstrip('\n') N = len(S) seen = set() new = [s for s in S] for i in range(0, N, 2): seen.add(S[i]) new[i] = ' ' for i in range(1, N, 2): if S[i] in seen: new[i] = ' ' exist = [] for i in range(N): if new[i] != ' ': exist.append(i) if len(exist) >= 2: diff = [exist[i+1] - exist[i] for i in range(len(exist) - 1)] if min(diff) == max(diff) == 2: print('Yes') exit() seen = set() new = [s for s in S] for i in range(1, N, 2): seen.add(S[i]) new[i] = ' ' for i in range(0, N, 2): if S[i] in seen: new[i] = ' ' exist = [] for i in range(N): if new[i] != ' ': exist.append(i) if len(exist) >= 2: diff = [exist[i + 1] - exist[i] for i in range(len(exist) - 1)] if min(diff) == max(diff) == 2: print('Yes') exit() print('NO') if __name__ == '__main__': main()