三元运算符+集合,应该是时间复杂度和常数时间都很好的做法了
print("Yes" if input().strip() in {"11","22","33","44","55","66","77","88","99"} else "No")