intT,M,N,K,I,a,b,c,cnt;charch;intarr[5005];piians;// {times, K}
voidinit(){cin>>N;for(inti=0;i<N;i++){cin>>ch;arr[i]=(ch=='B');// need to be reversed
}}intflip[5005],k;inlineboolget_dir(int&v){if(v-k<0)return(flip[v-1]&1)^arr[v];return((flip[v-1]-flip[v-k])&1)^arr[v];}piical(){memset(flip,0,sizeof(flip));inttimes=flip[0]=arr[0];for(inti=1;i+k-1<N;i++){flip[i]=flip[i-1];if(get_dir(i))++times,++flip[i];}// check if wrong direction
for(inti=N-k+1;i<N;i++){flip[i]=flip[i-1];if(get_dir(i))returnmake_pair(INT_MAX,1);}returnmake_pair(times,k);}voidsol(){k=1;ans=cal();for(inti=2;i<=N;i++){// K
k=i;ans=min(ans,cal());}cout<<ans.Y<<" "<<ans.X<<endl;}intmain(){ios::sync_with_stdio(false);cin.tie(0);init();sol();}