import java.io.*;
import java.util.*;

public class Main {
    static class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
    }

    static class Writer {
        PrintWriter cout;

        Writer() throws IOException {
            cout = new PrintWriter(System.out);
        }

        Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        }

        StringBuilder out = new StringBuilder();

        void print(Object a) {
            out.append(a);
        }

        void close() {
            cout.print(out.toString());
            cout.close();
        }
    }

    static class pair{
        int size, col;
        pair(int s, int col1){
            s = size;
            col = col1;
        }
    }

    public static void main(String args[]) throws IOException {
        Reader in = new Reader();
        Writer out = new Writer();
        String a = in.next();
        int max = 0;
        for (int i = 0; i < a.length(); i++) {
            if((int)a.charAt(i) != (int)'a'){
                int col = 0;
                int size = 1;
                if(i > 0 && (int)a.charAt(i-1) == (int)'a')
                    col++;
                while(i+1 < a.length() && (int)a.charAt(i+1) != (int)'a') {
                    i++;
                    size++;
                }
                if(i+1 < a.length() && (int)a.charAt(i+1) == (int)'a')
                    col++;

                if(col != 0){
                    int cur;
                    if(col == 1)
                        cur = size;
                    else
                        cur =  (size + size%2)/col;
                    if(cur > max)
                        max = cur;
                }
            }
        }
        out.print(max);
        out.close();
    }
}