#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>

using namespace std;
int dig[10];

int main(){
	int n;
	while(cin >> n){
		memset(dig,0,sizeof(dig));
		while(n){
			int m = n % 10;
			dig[m]++;
			n /= 10;
		}
		int i;
		for(i = 0;i < 10;i++)
			if(dig[i] >= 3){
				cout << "Yes" << endl;
				break;
			}
		if(i == 10) cout << "No" << endl;
	}
	return 0;
}
