//
// Written by Fyodor Menshikov 21.02.2006
// 4:17-4:35 wrong idea
// 4:53-4:55 OK
//
var
   len:array[1..1000000]of integer;
   s:string;
   i,curlen,period:integer;
begin
//   assign(input,'input.txt');
   reset(input);
//   assign(output,'output.txt');
   rewrite(output);
   readln(s);
   len[1]:=0;
   curlen:=0;
   for i:=2 to length(s) do begin
      while true do begin
         if s[i]=s[curlen+1] then begin
            inc(curlen);
            break;
         end;
         if curlen=0 then begin
            break;
         end;
         curlen:=len[curlen];
      end;
      len[i]:=curlen;
   end;
   curlen:=0;
   for i:=2 to length(s) do begin
      while true do begin
         if s[i]=s[curlen+1] then begin
            inc(curlen);
            break;
         end;
         if curlen=0 then begin
            break;
         end;
         curlen:=len[curlen];
      end;
   end;
   period:=length(s)-curlen;
   if period*2<=length(s) then
      writeln(period)
   else
      writeln('0');
end.