#include <bits/stdc++.h>
//file stream
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<sstream>
#include <set>

using namespace std;
#define output freopen("output.txt","w",stdout)
#define input freopen("input.txt","r",stdin)
#define inputfile(x) freopen(x,"r",stdin)
#define outpufile(x) freopen(x,"w",stdout)
//functions
#define pb(x)  push_back(x)
#define pf  printf
#define sc scanf
#define mxe(a,n)   (*max_element(a,a+n))
#define mne(a,n)   (*min_element(a,a+n))
#define SUM(a,n)   (accumulate(a,a+n,0))
#define countbit(x) __builtin_popcount(x)
#define lb  lower_bound // first element which does not compare less than
#define ub  upper_bound //first element which compares greater than
#define bs  binary_search
#define SQ(a)  ((a)*(a))
#define _PI (acos(-1.0))
#define mid(l,r)    ((l+r)>>1)


#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
// pair
#define xx first
#define yy second
#define mp(x,y) make_pair(x,y)
//inputs 1 var
#define si1(n) sc("%d",&n)
#define sl1(n) sc("%lld",&n)
#define slu1(n) sc("%llu",&n)
#define sd1(n) sc("%lf",&n)
#define ss1(n) sc("%s",n)
//inputs 2 var
#define si2(n,m) sc("%d %d",&n,&m)
#define sl2(n,m) sc("%lld %lld",&n,&m)
#define slu2(n,m) sc("%llu %llu",&n,&m)
#define sd2(n,m) sc("%lf %lf",&n,&m)
//inputs 3 var
#define si3(n,m,l) sc("%d %d %d",&n,&m,&l)
#define sl3(n,m,l) sc("%lld %lld %lld",&n,&m,&l)
#define slu3(n,m,l) sc("%llu %llu %llu",&n,&m,&l)
#define sd3(n,m,l) sc("%lf %lf %lf",&n,&m,&l)

//output 1 var
#define pi1(n) pf("%d",n)
#define pl1(n) pf("%lld",n)
#define plu1(n) pf("%llu",n)
#define pd1(n,pre) pf("%.*f",pre,n)
#define ps1(n) pf("%s",n)
//output 2 var
#define pi2(n,m) pf("%d %d",n,m)
#define pl2(n,m) pf("%lld %lld",n,m)
#define plu2(n,m) pf("%llu %llu",n,m)
#define pd2(n,m,pre) pf("%.*f %.*f",pre,n,pre,m)
//inputs 3 var less important
#define pi3(n,m,l) pf("%d %d %d",n,m,l)
#define pl3(n,m,l) pf("%lld %lld %lld",n,m,l)
#define plu3(n,m,l) pf("%llu %llu %llu",n,m,l)
//output misc
#define nln putchar(10)
#define sps putchar(' ')
#define pch(c) putchar(c)
#define tcsp(i) pf("Case %d: ",++i)
#define tcnl(i) pf("Case %d:\n",++i)
#define dg()   pf("-----------here\n")

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sc1(n) cin>>n
#define sc2(n,m) cin>>n>>m
#define sc3(n,m,k) cin>>n>>m>>k
#define sc4(n,m,k,l) cin>>n>>m>>k>>l

#define pr1(n) cout<<n
#define pr2(n,m) cout<<n<<" "<<m
#define pr3(n,m,k) cout<<n<<" "<<m<<" "<<k
#define pr4(n,m,k,l) cin<<n<<" "<<m<<" "<<k<<" "<<l
#define NL cout<<"\n"
#define SPS cout<<" "

#define setPre(x) setprecision(x)
#define fixP cout<<fixed



//loop
#define fr0(i,n) for(i=0;i<n;i++)
#define fr1(i,n) for(i=1;i<=n;i++)
#define FR(i,b,e) for(i=b;i<=e;i++)
#define FRR(i,e,b) for(i=e;i>=b;i--)
//memory reset
#define set0(x) memset(x,0,sizeof x)
#define set(x,v) memset(x,v,sizeof x)
#define setn1(x) memset(x,-1,sizeof x)
#define setinf(x) memset(x,125,sizeof x)
//misc
#define SZ(v)   ((int) (v).size())
#define all(v)  (v).begin(), (v).end()
//bit operation single variable
#define On(x,i)  (x|=(1<<(i)))
#define Off(x,i) (x&= ~(1<<(i)))
#define isOn(x,i) (x&(1<<(i)))
#define Toggle(x,i) (x^=(1<<(i)))
#define tmod(x,i)  (x&(~(-1<<i)))
//data type
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<pii ,pii > ppii;
typedef set<int> si;
typedef set<ll> sl;
typedef map<int,int> mii;
typedef map<ll,int> mli;
typedef map<string,int> msi;
typedef long double LD;
#define ran(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))

// 179 10000019 10000079 10000103 1000000007 1000000009 1000000021 hash base

template <class _T>inline void ina(_T a[],int n){int i; fr0(i,n)sc1(a[i]);}
template <class _T>inline void outa(_T a[],int n){int i; fr0(i,n-1)pr1(a[i]),SPS;if(i)pi1(i);NL;}

//constant
const double EPS = 1e-9;
const int SIZE=1e6;


///BIT
/*
//set _n and _lg first
int __bit[SIZE+100],_n,_lg;
inline void __inc(int i,int v){for(;i<=_n;i+=(i&-i))__bit[i]+=v;}
inline int __sum(int i){int s=0;for(;i;i-=(i&-i))s+=__bit[i];return s;}
inline int __select(int k){int p,i,h=0;for(i=_lg;i>-1;i--){p=1<<i;if(p+h>_n)continue;if(__bit[p+h]<k)h+=p,k-=__bit[h];}return h+1;}
*/
/*
//ncr
int const __maxn=1000;//set maxn firts
ll ncr[__maxn+2][__maxn+2];
inline void cal_ncr(){int i,j;ncr[0][0]=1;fr1(i,__maxn){ncr[i][0]=1;fr1(j,i)ncr[i][j]=ncr[i-1][j-1]+ncr[i-1][j];}}
*/
///seive
/*
const int __mx=1e6+5;
bool isp[__mx+5];
inline void seive(){isp[1]=0;int i,j;for(i=4;i<=__mx;i+=2)isp[i]=1;for(i=3;i*i<=__mx;i+=2)if(!isp[i])for(j=i*i;j<=__mx;j+=i+i)isp[j]=1;}
long long PL[__mx];
inline int make_prime_list(){int i=3,k=1;PL[0]=2;for(i=3;i<=__mx;i+=2)if(!isp[i])PL[k++]=i;return k;}
template<class _T>inline bool _isprime(_T n){if(n==1)return 0;int i;for(_T p=PL[i=0];p*p<=n;p=PL[++i])if(!(n%p))return 0;return 1;}
*/
//BIG MOD / mod inverse
template<class _T>inline _T pow(_T a,_T b,_T m){a%=m;_T ans=1%m;while(b){if(b&1)ans*=a,ans%=m;a*=a;a%=m;b>>=1;}return ans;}
template<class _T>inline _T pow(_T a,_T b){_T ans=1;while(b){if(b&1)ans*=a;a*=a;b>>=1;}return ans;}
template<class _T>inline _T add(_T a,_T b,_T m){return a>=m-b?a-(m-b):a+b;}//a,b<m
template<class _T>inline _T multiply(_T a,_T b,_T m){_T ans=0;if(b>a)swap(a,b);while(b){if(b&1)ans=add(ans,a,m);b>>=1;a=add(a,a,m);}return ans;}//a,b<m
template<class _T>inline _T bigpow(_T a,_T b,_T m){a%=m;_T ans=1%m;while(b){if(b&1)ans=multiply(ans,a,m);a=multiply(a,a,m);b>>=1;}return ans;}
template<class _T>inline _T modinvers(_T a,_T m){return m>2000000000LL?bigpow(a,m-2,m):pow(a,m-2,m);}//m is prime
//egcd / mod inverse
template<class _T> _T _egcd(_T a, _T b, _T &x,_T &y){if(!b){x=1,y=0;return a;}_T _g=_egcd(b,a%b,x,y);_T xt=x;x=y,y=xt-(a/b)*y;return _g;}
template<class _T>inline _T fmodinvers(_T a,_T m){_T x,y;_egcd(a,m,x,y);x%=m;if(x<0)x+=m;return x;} //a,m co-prime
template<class _T>inline _T _lcm(_T a, _T b){return (a*b)/__gcd(a,b);}
//summatiom
template<class _T>inline _T naturalSum(_T n){return (n*(n+1))/2;}
template<class _T>inline _T sqrSum(_T n){return (n * (n + 1) * (2*n + 1)) / 6;}
template<class _T>inline _T cubeSum(_T n){return  SQ((n*(n+1))/2);}
//with mod
//assuming (mod-1)^2 will fit in limit
template<class _T>inline _T naturalSum(_T n,_T m){return ((n*(n+1))/2)%m;}
ll MOD_INV_OF_6;//
template<class _T>inline _T sqrSum(_T n,_T m){n%=m;return ((( ((n * (n + 1))%m) * (( (2*n)%m + 1)%m)) %m )* MOD_INV_OF_6)%m;}
template<class _T>inline _T cubeSum(_T n,_T m){return  SQ(((n*(n+1))/2)%m)%m;}


/*
int par[100];
int findp(int _n){return par[_n]==_n?_n:par[_n]=findp(par[_n]);}
*/
//direction array
/*int dx[]={1,-1,1,-1,2,2,-2,-2};
int dy[]={2,2,-2,-2,1,-1,1,-1};
knight moves
*/

const int MX=2009;
int i,j,k,x,y,z,n,m;
int a[MX+5],b[MX+5],c[MX+5];
char s[10];
int main()
{

    ss1(s);

    if(s[0]==s[1]&&s[1]==s[2])pf("Yes\n");
    else if(s[2]==s[3]&&s[1]==s[2])pf("Yes\n");
    else pf("No\n");

    return 0;
}

/*
Md. Tariqul Islam
IIT, JU
tarik.amtoly@gmail.com
fb/tariqiitju
*/


Measured memory_bytes: 256