#include <stdio.h>
#include <stdlib.h>

int broj_slova(char str[100]){
    int i=0;
    while(str[i] != '\0'){
    	i++;
    }
    return i;
}

int main() {
	int i, j, x=0, k, max=0, zs=0, r=0, n, sn;
    char text[100], s[100], c;
	scanf("%s", text);
    n = broj_slova(text);
    for(i=0,k=0;i<n;i++){
        x = 0;
        for(j=0;j<i;j++){
            if(text[i] == text[j]){
                x = 1;
                break;
            }
            
        } 
        if(x == 0){
            s[k] = text[i];
            k++;
        }
    }
    sn = broj_slova(s);
    int bs[sn];
    for(i=0;i<sn;i++){
       bs[i] = 0;
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            if(s[i] == text[j]){
                bs[i]++;
            }
        }
    }
    for(i=0;i<sn;i++){
       if(bs[i]>max){
           max = bs[i];
       }
    }
    for(i=0;i<sn;i++){
       if(bs[i] == max){
           c = s[i];
           break;
       }
    }
    for(i=0;i<n;i++){
    	r = 0;
    	j = i + 1;
    	if(c == text[i]){
    		while(c != text[j]){
    			j++;
    			r++;
			}
			r++;
			if(r >= 3 && r % 2 != 0)
				zs++;
		}
	}
	printf("%d", zs);
	return 0;
}