stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>



#define int long long



using namespace std;



const int N = 5e5 + 5;

const int base = 317;

const int mod = 1e9 + 2277;



string s;

int Hash[N], pw[N], n;

bool pref[N], suff[N];



void buildHash(){

    s = "#" + s;

    pw[0] = 1;

    for (int i = 1; i < N; i++) pw[i] = (pw[i - 1] * base) % mod;

    Hash[0] = 0;

    for (int i = 1; i <= n; i++) Hash[i] = (Hash[i - 1] * base + s[i]) % mod;

}



int get (int l, int r) {

    return ((1LL * Hash[r] - 1LL * Hash[l - 1] * pw[r - l + 1]) % mod + mod) % mod;

}



signed main(){

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);



    cin >> s;

    n = s.length();



    bool same = true;

    for (int i = 0; i < n; i++) if (s[i] != s[0]) same = false;

    if (same) {

        cout << n << "\n" << 1;

        return 0;

    }



    buildHash();

    memset(pref, 0, sizeof(pref));

    memset(suff, 0, sizeof(suff));



    for (int i = 1; i <= n; i++) {

        for (int j = i * 2; j <= n; j = j + i) {

            if (get(1, i) == get(j - i + 1, j)) pref[j] = true;

            else break;

        }

    }



    for (int i = 1; i <= n; i++) {

        for (int j = n - i * 2 + 1; j >= 1; j = j - i) {

            if (get(j, j + i - 1) == get(n - i + 1, n)) suff[j] = true;

            else break;

        }

    }



    if (!pref[n]) return cout << 1 << "\n" << 1, 0;

    int ans = 0;

    for (int i = 1; i < n; i++) if (!pref[i] && !suff[i + 1]) ans++;

    cout << 2 << "\n" << ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 6.015531007881901x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N=2e6+20;

const ll mod=1e9+7;

char s[N],t[N];

int fail[N],suf[N];

void getfail(int *fail,char *s)

{

	fail[0]=-1;

	int i=0,j=-1;

	while(s[i])

	{

		if(j==-1||s[i]==s[j])

		{

			fail[i+1]=j+1;

			i++,j++;

		}

		else

			j=fail[j];

	}

}

int main()

{

	while(scanf("%s",s)!=EOF)

	{

		ll ans=0;

		int len=strlen(s);

		for(int i=0;s[i];i++)

			t[i]=s[len-i-1];

		t[len]='\0';

		getfail(fail,s);

		getfail(suf,t);

		int m;

	//	cout<<fail[len]<<endl;

		if(fail[len]==0||len%(len-fail[len]))

			m=1;

		else

			m=2;

		bool flag=true;

		for(int i=1;s[i];i++)

		{

			if(s[i]!=s[i-1])

				flag=false;

		}	

		if(flag)

			m=len;

		if(m==1||flag)

			ans=1;

		else

		{

			for(int i=0;i<len-1;i++)

			{

				int k=len-i-1;

			//	cout<<i<<' '<<k<<endl;

				if((fail[i+1]==0||(i+1)%((i+1)-fail[i+1])) &&(suf[k]==0||(k)%(k-suf[k])))

					ans++;

			}

		}	

		cout<<m<<endl<<ans<<endl;

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define int long long



using namespace std;



const int N = 5e5 + 5;

const int base = 317;

const int mod = 1e9 + 2277;



string s;

int Hash[N], pw[N], n;

bool pref[N], suff[N];



void buildHash(){

    s = "#" + s;

    pw[0] = 1;

    for (int i = 1; i < N; i++) pw[i] = (pw[i - 1] * base) % mod;

    Hash[0] = 0;

    for (int i = 1; i <= n; i++) Hash[i] = (Hash[i - 1] * base + s[i]) % mod;

}



int get (int l, int r) {

    return ((1LL * Hash[r] - 1LL * Hash[l - 1] * pw[r - l + 1]) % mod + mod) % mod;

}



signed main(){

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);



    cin >> s;

    n = s.length();



    bool same = true;

    for (int i = 0; i < n; i++) if (s[i] != s[0]) same = false;

    if (same) {

        cout << n << "\n" << 1;

        return 0;

    }



    buildHash();

    memset(pref, 0, sizeof(pref));

    memset(suff, 0, sizeof(suff));



    for (int i = 1; i <= n; i++) {

        for (int j = i * 2; j <= n; j = j + i) {

            if (get(1, i) == get(j - i + 1, j)) pref[j] = true;

            else break;

        }

    }



    for (int i = 1; i <= n; i++) {

        for (int j = n - i * 2 + 1; j >= 1; j = j - i) {

            if (get(j, j + i - 1) == get(n - i + 1, n)) suff[j] = true;

            else break;

        }

    }



    if (!pref[n]) return cout << 1 << "\n" << 1, 0;

    int ans = 0;

    for (int i = 1; i < n; i++) if (!pref[i] && !suff[i + 1]) ans++;

    cout << 2 << "\n" << ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 6.015531007881901x):
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;



const int N=2e6+20;

const ll mod=1e9+7;

char s[N],t[N];

int fail[N],suf[N];



void getfail(int *fail,char *s){

	fail[0]=-1;

	int i=0,j=-1;

	while(s[i]){

		if(j==-1||s[i]==s[j]){

			fail[i+1]=j+1;

			i++,j++;

		}

		else

			j=fail[j];

	}

}

int main(){

	while(scanf("%s",s)!=EOF){

		ll ans=0;

		int len=strlen(s);

		for(int i=0;s[i];i++)	t[i]=s[len-i-1];

		t[len]='\0';

		getfail(fail,s);

		getfail(suf,t);

		int m;

		if(fail[len]==0||len%(len-fail[len]))	m=1;

		else	m=2;

		bool flag=true;

		for(int i=1;s[i];i++)

			if(s[i]!=s[i-1])	flag=false;

		if(flag)	m=len;

		if(m==1||flag)	ans=1;

		else

			for(int i=0;i<len-1;i++){

				int k=len-i-1;

				if((fail[i+1]==0||(i+1)%((i+1)-fail[i+1])) &&(suf[k]==0||(k)%(k-suf[k])))	ans++;

			}

		cout<<m<<endl<<ans<<endl;

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define int long long



using namespace std;



const int N = 5e5 + 5;

const int base = 317;

const int mod = 1e9 + 2277;



string s;

int Hash[N], pw[N], n;

bool pref[N], suff[N];



void buildHash(){

    s = "#" + s;

    pw[0] = 1;

    for (int i = 1; i < N; i++) pw[i] = (pw[i - 1] * base) % mod;

    Hash[0] = 0;

    for (int i = 1; i <= n; i++) Hash[i] = (Hash[i - 1] * base + s[i]) % mod;

}



int get (int l, int r) {

    return ((1LL * Hash[r] - 1LL * Hash[l - 1] * pw[r - l + 1]) % mod + mod) % mod;

}



signed main(){

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);



    cin >> s;

    n = s.length();



    bool same = true;

    for (int i = 0; i < n; i++) if (s[i] != s[0]) same = false;

    if (same) {

        cout << n << "\n" << 1;

        return 0;

    }



    buildHash();

    memset(pref, 0, sizeof(pref));

    memset(suff, 0, sizeof(suff));



    for (int i = 1; i <= n; i++) {

        for (int j = i * 2; j <= n; j = j + i) {

            if (get(1, i) == get(j - i + 1, j)) pref[j] = true;

            else break;

        }

    }



    for (int i = 1; i <= n; i++) {

        for (int j = n - i * 2 + 1; j >= 1; j = j - i) {

            if (get(j, j + i - 1) == get(n - i + 1, n)) suff[j] = true;

            else break;

        }

    }



    if (!pref[n]) return cout << 1 << "\n" << 1, 0;

    int ans = 0;

    for (int i = 1; i < n; i++) if (!pref[i] && !suff[i + 1]) ans++;

    cout << 2 << "\n" << ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 6.114305327051571x):
#include<stdio.h>

#include<string>

#include<math.h>

#include<stdlib.h>

#include<set>

#include<bitset>

#include<map>

#include<vector>

#include<string.h>

#include<algorithm>

#include<iostream>

#include<queue>

#include<deque>

#include<stack>

#include<cmath>

#include<ctime>

#include<complex>

#include<list>

#include<limits.h>

using namespace std;



const int N=5e5+5;

int n=1,tot;



void failure(char s[],int fail[]){

	fail[1]=0;

	for(int i=2,j=0;i<=n;i++){

		while(j&&s[j+1]!=s[i]) j=fail[j];

		if(s[j+1]==s[i]) j++;

		fail[i]=j;

	}

}



char s[N],rs[N];

int f[N],rf[N];



int main(){

	scanf("%s",s);

	n=strlen(s);

	for(int i=1;i<=n;i++) rs[i]=s[n-i];

	rs[n+1]='\0';

	for(int i=n;i>=1;i--) s[i]=s[i-1];

	s[n+1]='\0';

	failure(s,f);

	failure(rs,rf);

	if(f[n]==n-1) printf("%d\n1\n",n);

	else if(f[n]==0||rf[n]==0||n%(n-f[n])!=0||n%(n-rf[n])!=0) puts("1\n1");

	else{

		for(int i=1;i<n;i++) if((i%(i-f[i])!=0||f[i]==0)&&(rf[n-i]==0||(n-i)%(n-i-rf[n-i])!=0)) tot++;

		printf("2\n%d\n",tot);

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define int long long



using namespace std;



const int N = 5e5 + 5;

const int base = 317;

const int mod = 1e9 + 2277;



string s;

int Hash[N], pw[N], n;

bool pref[N], suff[N];



void buildHash(){

    s = "#" + s;

    pw[0] = 1;

    for (int i = 1; i < N; i++) pw[i] = (pw[i - 1] * base) % mod;

    Hash[0] = 0;

    for (int i = 1; i <= n; i++) Hash[i] = (Hash[i - 1] * base + s[i]) % mod;

}



int get (int l, int r) {

    return ((1LL * Hash[r] - 1LL * Hash[l - 1] * pw[r - l + 1]) % mod + mod) % mod;

}



signed main(){

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);



    cin >> s;

    n = s.length();



    bool same = true;

    for (int i = 0; i < n; i++) if (s[i] != s[0]) same = false;

    if (same) {

        cout << n << "\n" << 1;

        return 0;

    }



    buildHash();

    memset(pref, 0, sizeof(pref));

    memset(suff, 0, sizeof(suff));



    for (int i = 1; i <= n; i++) {

        for (int j = i * 2; j <= n; j = j + i) {

            if (get(1, i) == get(j - i + 1, j)) pref[j] = true;

            else break;

        }

    }



    for (int i = 1; i <= n; i++) {

        for (int j = n - i * 2 + 1; j >= 1; j = j - i) {

            if (get(j, j + i - 1) == get(n - i + 1, n)) suff[j] = true;

            else break;

        }

    }



    if (!pref[n]) return cout << 1 << "\n" << 1, 0;

    int ans = 0;

    for (int i = 1; i < n; i++) if (!pref[i] && !suff[i + 1]) ans++;

    cout << 2 << "\n" << ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 32.23184604249596x):
#include <stdio.h>

#include <string.h>

#include <algorithm>

#define Maxn 500005

char s[Maxn];

int n, ans, fail1[Maxn], fail2[Maxn];

void buildFail(char *s, int *fail) {

	int j = fail[0] = -1;

	for (int i = 1; i <= n; ++ i) {

		while (j >= 0 && s[j] != s[i - 1]) j = fail[j];

		fail[i] = ++ j;

	}

}

int main() {

	scanf("%s", s); n = strlen(s);

	buildFail(s, fail1);

	int len = n % (n - fail1[n]) == 0 && (n - fail1[n] <= n / 2) ? n - fail1[n] : -1;

	if (len == -1) return puts("1\n1") & 0;

	if (len == 1) return printf("%d\n1\n", n) & 0;

	puts("2"); std :: reverse(s, s + n);

	buildFail(s, fail2); for (int i = 1; i < n; ++ i)

		if ((!fail1[i] || i % (i - fail1[i])) && (!fail2[n - i] || (n - i) % ((n - i) - fail2[n - i]))) ++ ans;

	printf("%d\n", ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N=2e6+20;

const ll mod=1e9+7;

char s[N],t[N];

int fail[N],suf[N];

void getfail(int *fail,char *s)

{

	fail[0]=-1;

	int i=0,j=-1;

	while(s[i])

	{

		if(j==-1||s[i]==s[j])

		{

			fail[i+1]=j+1;

			i++,j++;

		}

		else

			j=fail[j];

	}

}

int main()

{

	while(scanf("%s",s)!=EOF)

	{

		ll ans=0;

		int len=strlen(s);

		for(int i=0;s[i];i++)

			t[i]=s[len-i-1];

		t[len]='\0';

		getfail(fail,s);

		getfail(suf,t);

		int m;

	//	cout<<fail[len]<<endl;

		if(fail[len]==0||len%(len-fail[len]))

			m=1;

		else

			m=2;

		bool flag=true;

		for(int i=1;s[i];i++)

		{

			if(s[i]!=s[i-1])

				flag=false;

		}	

		if(flag)

			m=len;

		if(m==1||flag)

			ans=1;

		else

		{

			for(int i=0;i<len-1;i++)

			{

				int k=len-i-1;

			//	cout<<i<<' '<<k<<endl;

				if((fail[i+1]==0||(i+1)%((i+1)-fail[i+1])) &&(suf[k]==0||(k)%(k-suf[k])))

					ans++;

			}

		}	

		cout<<m<<endl<<ans<<endl;

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.358104878898291x):
#include <stdio.h>

#include <string.h>

#include <algorithm>

#define Maxn 500005

char s[Maxn];

int n, ans, fail1[Maxn], fail2[Maxn];

void buildFail(char *s, int *fail) {

	int j = fail[0] = -1;

	for (int i = 1; i <= n; ++ i) {

		while (j >= 0 && s[j] != s[i - 1]) j = fail[j];

		fail[i] = ++ j;

	}

}

int main() {

	scanf("%s", s); n = strlen(s);

	buildFail(s, fail1);

	int len = n % (n - fail1[n]) == 0 && (n - fail1[n] <= n / 2) ? n - fail1[n] : -1;

	if (len == -1) return puts("1\n1") & 0;

	if (len == 1) return printf("%d\n1\n", n) & 0;

	puts("2"); std :: reverse(s, s + n);

	buildFail(s, fail2); for (int i = 1; i < n; ++ i)

		if ((!fail1[i] || i % (i - fail1[i])) && (!fail2[n - i] || (n - i) % ((n - i) - fail2[n - i]))) ++ ans;

	printf("%d\n", ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;



const int N=2e6+20;

const ll mod=1e9+7;

char s[N],t[N];

int fail[N],suf[N];



void getfail(int *fail,char *s){

	fail[0]=-1;

	int i=0,j=-1;

	while(s[i]){

		if(j==-1||s[i]==s[j]){

			fail[i+1]=j+1;

			i++,j++;

		}

		else

			j=fail[j];

	}

}

int main(){

	while(scanf("%s",s)!=EOF){

		ll ans=0;

		int len=strlen(s);

		for(int i=0;s[i];i++)	t[i]=s[len-i-1];

		t[len]='\0';

		getfail(fail,s);

		getfail(suf,t);

		int m;

		if(fail[len]==0||len%(len-fail[len]))	m=1;

		else	m=2;

		bool flag=true;

		for(int i=1;s[i];i++)

			if(s[i]!=s[i-1])	flag=false;

		if(flag)	m=len;

		if(m==1||flag)	ans=1;

		else

			for(int i=0;i<len-1;i++){

				int k=len-i-1;

				if((fail[i+1]==0||(i+1)%((i+1)-fail[i+1])) &&(suf[k]==0||(k)%(k-suf[k])))	ans++;

			}

		cout<<m<<endl<<ans<<endl;

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.358104878898291x):
#include <stdio.h>

#include <string.h>

#include <algorithm>

#define Maxn 500005

char s[Maxn];

int n, ans, fail1[Maxn], fail2[Maxn];

void buildFail(char *s, int *fail) {

	int j = fail[0] = -1;

	for (int i = 1; i <= n; ++ i) {

		while (j >= 0 && s[j] != s[i - 1]) j = fail[j];

		fail[i] = ++ j;

	}

}

int main() {

	scanf("%s", s); n = strlen(s);

	buildFail(s, fail1);

	int len = n % (n - fail1[n]) == 0 && (n - fail1[n] <= n / 2) ? n - fail1[n] : -1;

	if (len == -1) return puts("1\n1") & 0;

	if (len == 1) return printf("%d\n1\n", n) & 0;

	puts("2"); std :: reverse(s, s + n);

	buildFail(s, fail2); for (int i = 1; i < n; ++ i)

		if ((!fail1[i] || i % (i - fail1[i])) && (!fail2[n - i] || (n - i) % ((n - i) - fail2[n - i]))) ++ ans;

	printf("%d\n", ans);

	return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<string>

#include<math.h>

#include<stdlib.h>

#include<set>

#include<bitset>

#include<map>

#include<vector>

#include<string.h>

#include<algorithm>

#include<iostream>

#include<queue>

#include<deque>

#include<stack>

#include<cmath>

#include<ctime>

#include<complex>

#include<list>

#include<limits.h>

using namespace std;



const int N=5e5+5;

int n=1,tot;



void failure(char s[],int fail[]){

	fail[1]=0;

	for(int i=2,j=0;i<=n;i++){

		while(j&&s[j+1]!=s[i]) j=fail[j];

		if(s[j+1]==s[i]) j++;

		fail[i]=j;

	}

}



char s[N],rs[N];

int f[N],rf[N];



int main(){

	scanf("%s",s);

	n=strlen(s);

	for(int i=1;i<=n;i++) rs[i]=s[n-i];

	rs[n+1]='\0';

	for(int i=n;i>=1;i--) s[i]=s[i-1];

	s[n+1]='\0';

	failure(s,f);

	failure(rs,rf);

	if(f[n]==n-1) printf("%d\n1\n",n);

	else if(f[n]==0||rf[n]==0||n%(n-f[n])!=0||n%(n-rf[n])!=0) puts("1\n1");

	else{

		for(int i=1;i<n;i++) if((i%(i-f[i])!=0||f[i]==0)&&(rf[n-i]==0||(n-i)%(n-i-rf[n-i])!=0)) tot++;

		printf("2\n%d\n",tot);

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2715466955652905x):
#include <stdio.h>

#include <string.h>

#include <algorithm>

#define Maxn 500005

char s[Maxn];

int n, ans, fail1[Maxn], fail2[Maxn];

void buildFail(char *s, int *fail) {

	int j = fail[0] = -1;

	for (int i = 1; i <= n; ++ i) {

		while (j >= 0 && s[j] != s[i - 1]) j = fail[j];

		fail[i] = ++ j;

	}

}

int main() {

	scanf("%s", s); n = strlen(s);

	buildFail(s, fail1);

	int len = n % (n - fail1[n]) == 0 && (n - fail1[n] <= n / 2) ? n - fail1[n] : -1;

	if (len == -1) return puts("1\n1") & 0;

	if (len == 1) return printf("%d\n1\n", n) & 0;

	puts("2"); std :: reverse(s, s + n);

	buildFail(s, fail2); for (int i = 1; i < n; ++ i)

		if ((!fail1[i] || i % (i - fail1[i])) && (!fail2[n - i] || (n - i) % ((n - i) - fail2[n - i]))) ++ ans;

	printf("%d\n", ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define int long long



using namespace std;



const int N = 5e5 + 5;

const int base = 317;

const int mod = 1e9 + 2277;



string s;

int Hash[N], pw[N], n;

bool pref[N], suff[N];



void buildHash(){

    s = "#" + s;

    pw[0] = 1;

    for (int i = 1; i < N; i++) pw[i] = (pw[i - 1] * base) % mod;

    Hash[0] = 0;

    for (int i = 1; i <= n; i++) Hash[i] = (Hash[i - 1] * base + s[i]) % mod;

}



int get (int l, int r) {

    return ((1LL * Hash[r] - 1LL * Hash[l - 1] * pw[r - l + 1]) % mod + mod) % mod;

}



signed main(){

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);



    cin >> s;

    n = s.length();



    bool same = true;

    for (int i = 0; i < n; i++) if (s[i] != s[0]) same = false;

    if (same) {

        cout << n << "\n" << 1;

        return 0;

    }



    buildHash();

    memset(pref, 0, sizeof(pref));

    memset(suff, 0, sizeof(suff));



    for (int i = 1; i <= n; i++) {

        for (int j = i * 2; j <= n; j = j + i) {

            if (get(1, i) == get(j - i + 1, j)) pref[j] = true;

            else break;

        }

    }



    for (int i = 1; i <= n; i++) {

        for (int j = n - i * 2 + 1; j >= 1; j = j - i) {

            if (get(j, j + i - 1) == get(n - i + 1, n)) suff[j] = true;

            else break;

        }

    }



    if (!pref[n]) return cout << 1 << "\n" << 1, 0;

    int ans = 0;

    for (int i = 1; i < n; i++) if (!pref[i] && !suff[i + 1]) ans++;

    cout << 2 << "\n" << ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 6.0217286476204155x):
#include <stdio.h>

#include <iostream>

#include <cstdlib>

#include <cmath>

#include <cctype>

#include <string>

#include <cstring>

#include <algorithm>

#include <stack>

#include <queue>

#include <set>

#include <map>

#include <ctime>

#include <vector>

#include <fstream>

#include <list>

#include <iomanip>

#include <numeric>

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

#define ms(s) memset(s, 0, sizeof(s))

const int INF = 1e9;

inline int read(){

	int X = 0,w = 0 ;

	char ch = 0;

	while(!isdigit(ch)) {w |= ch == '-';ch = getchar();}

	while(isdigit(ch)) X = (X<<3) + (X<<1) + (ch ^ 48),ch = getchar();

	return w ? -X : X;

}

int nxt[1000005];

int nxt2[1000005];

int n;

char s[1000005];

void get_nxt()

{

	nxt[0]=-1;

	for(int i=0,j=-1;i<n;i++)

	{

		while(~j and s[i]!=s[j])

		{

			j=nxt[j];

		}

		nxt[i+1]=++j;

	}

}

void get_nxt2()

{

	nxt2[0]=-1;

	for(int i=0,j=-1;i<n;i++)

	{

		while(~j and s[i]!=s[j])

		{

			j=nxt2[j];

		}

		nxt2[i+1]=++j;

	}

}

int main() 

{

	scanf("%s",s);

	n=strlen(s);

	get_nxt();

	reverse(s,s+n);

	get_nxt2();

	if(n%(n-nxt[n])!=0 or nxt[n]==0)

	{

		cout<<1<<endl<<1;

		return 0;

	}

	if(n-nxt[n]==1)

	{

		cout<<n<<endl<<1<<endl;

		return 0;

	}

	int ans=0;

	for(int i=1;i<n;i++)

	{

		int a=i;

		int b=n-i;

		if((a%(a-nxt[a])!=0 or nxt[a]==0) and (b%(b-nxt2[b])!=0 or nxt2[b]==0))

		{

			ans++;

		}

	}

	cout<<2<<endl;

	cout<<ans;

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define int long long



using namespace std;



const int N = 5e5 + 5;

const int base = 317;

const int mod = 1e9 + 2277;



string s;

int Hash[N], pw[N], n;

bool pref[N], suff[N];



void buildHash(){

    s = "#" + s;

    pw[0] = 1;

    for (int i = 1; i < N; i++) pw[i] = (pw[i - 1] * base) % mod;

    Hash[0] = 0;

    for (int i = 1; i <= n; i++) Hash[i] = (Hash[i - 1] * base + s[i]) % mod;

}



int get (int l, int r) {

    return ((1LL * Hash[r] - 1LL * Hash[l - 1] * pw[r - l + 1]) % mod + mod) % mod;

}



signed main(){

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);



    cin >> s;

    n = s.length();



    bool same = true;

    for (int i = 0; i < n; i++) if (s[i] != s[0]) same = false;

    if (same) {

        cout << n << "\n" << 1;

        return 0;

    }



    buildHash();

    memset(pref, 0, sizeof(pref));

    memset(suff, 0, sizeof(suff));



    for (int i = 1; i <= n; i++) {

        for (int j = i * 2; j <= n; j = j + i) {

            if (get(1, i) == get(j - i + 1, j)) pref[j] = true;

            else break;

        }

    }



    for (int i = 1; i <= n; i++) {

        for (int j = n - i * 2 + 1; j >= 1; j = j - i) {

            if (get(j, j + i - 1) == get(n - i + 1, n)) suff[j] = true;

            else break;

        }

    }



    if (!pref[n]) return cout << 1 << "\n" << 1, 0;

    int ans = 0;

    for (int i = 1; i < n; i++) if (!pref[i] && !suff[i + 1]) ans++;

    cout << 2 << "\n" << ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 6.112334399453611x):
/*

  mail: mleautomaton@foxmail.com

  author: MLEAutoMaton

  This Code is made by MLEAutoMaton

*/

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<math.h>

#include<algorithm>

#include<queue>

#include<set>

#include<map>

#include<iostream>

using namespace std;

#define ll long long

#define REP(a,b,c) for(int a=b;a<=c;a++)

#define re register

#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)

inline int gi(){

	int f=1,sum=0;char ch=getchar();

	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}

	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}

	return f*sum;

}

const int N=1000010;

char s[N];

int n,nxt[N],pre[N];

void init(){

	int j=0;nxt[1]=0;

	for(int i=2;i<=n;i++){

		while(j && s[j+1]!=s[i])j=nxt[j];

		if(s[j+1]==s[i])j++;

		nxt[i]=j;

	}

	j=n+1;pre[n]=n+1;

	for(int i=n-1;i;i--){

		while(j<=n && s[j-1]!=s[i])j=pre[j];

		if(s[i]==s[j-1])j--;

		pre[i]=j;

	}

}

bool check(int id){

	int flag1=(!nxt[id] || id%(id-nxt[id]));

	int flag2=(pre[id+1]==n+1 || (n-id)%(n-id-(n-pre[id+1]+1)));

	return (flag1&flag2);

}

int main(){

	scanf("%s",s+1);n=strlen(s+1);

	init();

	if(!nxt[n] || n%(n-nxt[n]))return printf("1\n1\n"),0;

	if(nxt[n]==n-1)return printf("%d\n1\n",n),0;

	int sum=0;

	for(int i=1;i<n;i++)if(check(i))sum++;

	printf("2\n%d\n",sum);

	return 0;

}