import java.util.List;  
import java.util.Scanner;  
  
  
public class Main {  
  
    public static void main(String[] args) {  
        // TODO Auto-generated method stub  
  
        int[] count = new int[27];//TDW排列  
        int[] tmp = new int[27];//TDW排列  
        List huPai = new ArrayList();  
        for(int i=0;i<27;i++){  
            count[i]=0;  
        }  
        Scanner cin = new Scanner(System.in);  
        String line = cin.nextLine();  
        int len = line.length();  
        for(int i=0;i=2){  
                    count[i] -= 2;  
                    if(tryHU(count, len - 2))  
                        return true;  
                    count[i] += 2;  
                }  
            }  
        }  
        else{  
            //三个一样的  
            for(int i=0;i<27;i++){  
                if(count[i]>=3){  
                    count[i] -= 3;  
                    if(tryHU(count, len - 3))  
                        return true;  
                    count[i] += 3;  
                }  
            }  
            //是否是顺子  
            for(int i=0;i<27-2;i++){  
                if(count[i]>0&&count[i+1]>0&&count[i+2]>0){  
                    count[i] -= 1;  
                    count[i+1] -= 1;  
                    count[i+2] -= 1;  
                    if(tryHU(count, len - 3))  
                        return true;  
                    count[i] += 1;  
                    count[i+1] += 1;  
                    count[i+2] += 1;  
                }  
            }  
        }  
        return false;  
    }  
  
}