{
task: repeats
lang: pascal
}
program rep;
var f :text;
max,w,l,r,  t, j,k,iki,n, i:longint;
   mas :array [ 1.. 50000 ] of boolean;
   a:char;
 begin
  assign ( f,'repeats.in');
  reset ( f );   {repeat.out}
readln (f, n );
  for i := 1 to n do
   begin
    readln( f, a );
    if a='b' then mas[i]:= true;
  end;
  iki :=( 15000000 div n );
  if iki = 0 then iki :=1;
  if iki > 50000 then iki := 50000;
  if iki > n-1 then iki :=n-1;

  for k:= 1 to iki do
  if max > n div k then break else
   for i := 1  to n- k+1 do
    begin
      j:=i+ k;
      t:=0;
      r:=0;
      while (j <= n)and ( mas[j]=mas[i+r]) do
       begin
        inc ( j );
        inc (r);
        if r = k then
        begin
        r:=r mod k;
        t:=t+1;
        end;
       end;
       inc (t);
      if t > max then
      begin
      if max = n then break;
        max:=t;
        l:=k;
        w:=i;
      end;
    end;
   assign ( f,'repeats.out');
   rewrite ( f );
   writeln ( f, max);
   writeln (f,l);
   writeln(f,w );
   close ( f );
  end.

