I found an interesting problem on https://atcoder.jp/contests/abc079/tasks/abc079_a:
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?

-----Constraints-----
 - 1000 ≤ N ≤ 9999
 - N is an integer.

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
If N is good, print Yes; otherwise, print No.

-----Sample Input-----
1118

-----Sample Output-----
Yes

N is good, since it contains three consecutive 1.

I tried it in Python, but could not do it. Can you solve it?
n = input()
arr = []
for i in range(10):
    s = ""
    for j in range(3):
        s += str(i)
    arr.append(s)

if n[0:3] in arr or n[1:4] in arr:
    print("Yes")
else:
    print("No")