We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**.  You are given a 4-digit integer N. Answer the question: Is N **good**?
s = input()
prev_c = ""
count = 0
for c in s:
  if(c == prev_c):
    count += 1
  elif(count < 3):
    count = 0
  prev_c = c
print(count)
s = input()
if(s[0] == s[1]):
    if(s[1] == s[2]):
        print("Yes")
        exit()
if(s[1] == s[2]):
    if(s[2] == s[3]):
        print("Yes")
        exit()
print("No")
