#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string S;
  cin >> S;
  if (S.size() != 2)
    for (int i = 0; i < S.size() - 1; ++i)
      if (S[i] == S[i + 1]) {
        cout << "YES" << endl;
        return 0;
      }
  if (S.size() != 3)
    for (int i = 1; i < S.size() - 1; ++i)
      if (S[i - 1] == S[i + 1]) {
        cout << "YES" << endl;
        return 0;
      }
  cout << "NO" << endl;
  return 0;
}
