import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	string s;
	while ((s = readln.strip) != "")
	{
		auto n = s.length.to !(int);
		s ~= s;
		int res = 1;
		int cur = 1;
		foreach (i; 1..n * 2)
		{
			if (s[i - 1] != s[i])
			{
				cur += 1;
				res = max (res, cur);
			}
			else
			{
				cur = 1;
			}
		}
		res = min (res, n);
		writeln (res);
	}
}
