import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 998244353;

void main() {
    auto S = readln.chomp;
    auto N = S.length.to!int;
    S ~= S;
    char prev = S[0];
    int tmp = 0;
    int ans = 0;

    foreach (i; 0..2*N) {
        if (S[i] == prev) {
            tmp = 1;
        } else {
            tmp += 1;
        }
        ans = max(ans, tmp);
        prev = S[i];
    }

    ans = min(ans, N);
    ans.writeln;
}
