#include #include #include using namespace std; const int maxn=40010; const int x=33; int n,m,pos; unsigned long long H[maxn],xp[maxn],hsh[maxn]; int rnk[maxn]; int cmp(int a,int b) { return hsh[a]=m) pos=max(pos,rnk[i]); } return pos>=0; } char s[maxn]; int main() { #ifdef local freopen("pro.in","r",stdin); #endif xp[0]=1; for(int i=1;i=0;i--) H[i]=H[i+1]*x+s[i]-'a'; if(!possible(1)) printf("none\n"); else { int L=1,R=n+1; while(R-L>1) { int M=(L+R)/2; if(possible(M)) L=M; else R=M; } possible(L); printf("%d %d\n",L,pos); } } return 0; }