import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void main()
{
    auto S = readln.chomp;
    int[] ks;
    int k;
    char last;
    foreach (c; S) {
        if (c != last) {
            if (k) ks ~= k;
            k = 0;
            last = c;
        }
        ++k;
    }
    ks ~= k;

    if (ks.length == 2) {
        writeln(max(ks[0], ks[1]));
    } else {
        int r;
        foreach (i; 0..ks.length-1) r = max(r, ks[i] + ks[i+1]);
        writeln(r);
    }
}