S=input() print('Yes' if S[0]==S[1] and (S[2] == S[1] or S[2] == S[0]) else 'No')