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

using namespace std;

typedef long long lint;

typedef unsigned long long ulint;

typedef pair<int, int> pii;

typedef pair<lint, lint> pll;

#define endl '\n'

#define next next_

#define fst first

#define sed second

#define pb push_back

#define mp make_pair

#define rint register int

#define newline putchar('\n')

#define leave_space puthchar(' ')

#define all(x) (x).begin(), (x).end()

#define reveal(x) cerr << #x << " = " << (x) << endl

#define rep(it, f, e) for (rint it = f; it <= e; ++it)

#define per(it, f, e) for (rint it = f; it >= e; --it)

const int MAXN = 5e5 + 20;

char s[MAXN], t[MAXN];

int n, fail1[MAXN], fail2[MAXN];

inline void getfail(int fail[], char s[]) {

	int j = 0;

	fail[0] = -1;

	rep (i, 1, n - 1) { 

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

		fail[i + 1] = s[i] == s[j] ? ++j : 0;

	}

}

inline bool check_cyc1(int x) {

	return fail1[x] == 0 || x % (x - fail1[x]);

}

inline bool check_cyc2(int x) {

	if (x == 0) return false;

	return fail2[x] == 0 || x % (x - fail2[x]);

}

int main() {

	scanf("%s", s);

	n = strlen(s);

	memcpy(t, s, sizeof(t));

	reverse(t, t + n);

	getfail(fail1, s);

	getfail(fail2, t);

	int res = check_cyc1(n) ? 1 : 2;

	bool flag = true;

	rep (i, 1, n - 1) {

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

			flag = false;

			break;

		}

	}

	if (flag) {

		cout << n << endl;

		cout << 1 << endl;

	} else if (res == 1) {

		cout << 1 << endl;

		cout << 1 << endl;

	} else {

		int ans = 0;

		rep (i, 0, n - 1) {

			ans += (check_cyc1(i + 1) && check_cyc2(n - i - 1));

		}

		cout << 2 << endl;

		cout << ans << endl;

	}

	return 0;

}

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

  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;

}
// 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.1154786239471814x):
// ===================================

//   author: M_sea

//   website: http://m-sea-blog.com/

// ===================================

#include <algorithm>

#include <iostream>

#include <cstdlib>

#include <cstring>

#include <cstdio>

#include <cmath>

#define re register

using namespace std;



inline int read() {

    int X=0,w=1; char c=getchar();

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

    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();

    return X*w;

}



const int N=500000+10;



int n; char s[N];

int prenxt[N],sufnxt[N];



inline void getnext() {

    for (re int i=2,j=prenxt[1]=0;i<=n;++i) {

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

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

        prenxt[i]=j;

    }

    reverse(s+1,s+n+1);

    for (re int i=2,j=sufnxt[n]=0;i<=n;++i) {

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

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

        sufnxt[i]=j;

    }

}



inline int checkpre(int i) { return !prenxt[i]||i%(i-prenxt[i]); }

inline int checksuf(int i) { return !sufnxt[i]||i%(i-sufnxt[i]); }



int main() {

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

    if (checkpre(n)) { puts("1\n1"); return 0; }

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

    int ans=0;

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

        if (checkpre(i)&&checksuf(n-i)) ++ans;

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

    return 0;

}

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

using namespace std;

typedef long long lint;

typedef unsigned long long ulint;

typedef pair<int, int> pii;

typedef pair<lint, lint> pll;

#define endl '\n'

#define next next_

#define fst first

#define sed second

#define pb push_back

#define mp make_pair

#define rint register int

#define newline putchar('\n')

#define leave_space puthchar(' ')

#define all(x) (x).begin(), (x).end()

#define reveal(x) cerr << #x << " = " << (x) << endl

#define rep(it, f, e) for (rint it = f; it <= e; ++it)

#define per(it, f, e) for (rint it = f; it >= e; --it)

const int MAXN = 5e5 + 20;

char s[MAXN], t[MAXN];

int n, fail1[MAXN], fail2[MAXN];

inline void getfail(int fail[], char s[]) {

	int j = 0;

	fail[0] = -1;

	rep (i, 1, n - 1) { 

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

		fail[i + 1] = s[i] == s[j] ? ++j : 0;

	}

}

inline bool check_cyc1(int x) {

	return fail1[x] == 0 || x % (x - fail1[x]);

}

inline bool check_cyc2(int x) {

	if (x == 0) return false;

	return fail2[x] == 0 || x % (x - fail2[x]);

}

int main() {

	scanf("%s", s);

	n = strlen(s);

	memcpy(t, s, sizeof(t));

	reverse(t, t + n);

	getfail(fail1, s);

	getfail(fail2, t);

	int res = check_cyc1(n) ? 1 : 2;

	bool flag = true;

	rep (i, 1, n - 1) {

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

			flag = false;

			break;

		}

	}

	if (flag) {

		cout << n << endl;

		cout << 1 << endl;

	} else if (res == 1) {

		cout << 1 << endl;

		cout << 1 << endl;

	} else {

		int ans = 0;

		rep (i, 0, n - 1) {

			ans += (check_cyc1(i + 1) && check_cyc2(n - i - 1));

		}

		cout << 2 << endl;

		cout << ans << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.0216806255774067x):
// ===================================

//   author: M_sea

//   website: http://m-sea-blog.com/

// ===================================

#include <algorithm>

#include <iostream>

#include <cstdlib>

#include <cstring>

#include <cstdio>

#include <cmath>

#define re register

using namespace std;



inline int read() {

    int X=0,w=1; char c=getchar();

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

    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();

    return X*w;

}



const int N=500000+10;



int n; char s[N];

int prenxt[N],sufnxt[N];



inline void getnext() {

    for (re int i=2,j=prenxt[1]=0;i<=n;++i) {

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

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

        prenxt[i]=j;

    }

    reverse(s+1,s+n+1);

    for (re int i=2,j=sufnxt[n]=0;i<=n;++i) {

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

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

        sufnxt[i]=j;

    }

}



inline int checkpre(int i) { return !prenxt[i]||i%(i-prenxt[i]); }

inline int checksuf(int i) { return !sufnxt[i]||i%(i-sufnxt[i]); }



int main() {

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

    if (checkpre(n)) { puts("1\n1"); return 0; }

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

    int ans=0;

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

        if (checkpre(i)&&checksuf(n-i)) ++ans;

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

    return 0;

}

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

using namespace std;



const int N = 5e5 + 5;

const int mod = 1e9 + 9277;



int n;

string s;

int hs[N], pw[N];

bool prf[N], suf[N];



int get(int l,int r) {

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

}



int main() {

	ios_base::sync_with_stdio(false);

	cin >> s; n = s.size(); s = '#' + s;

	hs[0] = 0, pw[0] = 1;

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

		hs[i] = (1LL * hs[i - 1] * 1007 % mod + (s[i] - 'a' + 1)) % mod;

		pw[i] = 1LL * pw[i - 1] * 1007 % mod;

	}

	

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

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

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

			else break;

		}

	}

	

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

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

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

			else break;

		}

	}

	

	if (!prf[n]) return cout << 1 << '\n' << 1 << '\n',0;

	int cnt = 0;

	for (int i = 1; i < n; ++i) if (!prf[i] && !suf[i + 1]) {

		cnt++;

	} 

	if (cnt) cout << 2 << '\n' << cnt << '\n';

	else cout << n << '\n' << 1 << '\n';

}

// Faster C++ solution for the same problem (measured speedup: 5.38121937274377x):
#include <cmath>

#include <cstdio>

#include <cstring>

#include <algorithm>

using std::min; using std::max;

using std::swap; using std::sort;

typedef long long ll;



template<typename T>

void read(T &x) {

	int flag = 1; x = 0; char ch = getchar();

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

	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();

	x *= flag;

}



const int _ = 5e5 + 10, P = 1e9 + 7;

int n, p[_], s[_]; char c[_];



int chk0(int r) {

	int len = r, now = len % (len - p[r]);

	if(!now) return len / (len - p[r]) == 1;

	return 1;

}



int chk1(int l) {

	int len = n - l + 1, now = len % (len - s[l]);

	if(!now) return len / (len - s[l]) == 1;

	return 1;

}



int main () {

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

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

		int j = p[i - 1];

		while(j && c[j + 1] != c[i]) j = p[j];

		j += c[j + 1] == c[i], p[i] = j;

	}

	std::reverse(c + 1, c + n + 1);

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

		int j = s[i - 1];

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

		j += c[j + 1] == c[i], s[i] = j;

	}

	std::reverse(s + 1, s + n + 1);

	std::reverse(c + 1, c + n + 1);

	int now = n - p[n];

	if(now == 1) return printf("%d\n%d\n", n, 1), 0;

	if(n % now == 0 && n / now > 1) {

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

		int ret = 0;

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

			if(chk0(i) && chk1(i + 1)) ++ret;

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

	} else printf("%d\n%d\n", 1, 1);

	return 0;

} 

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

using namespace std;

int n, cnt;

char s[500020];

int p[500020];

int f[500020];

int g[500020];

void gao(int *f) {

	int u = 0;

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

		while (u > 0 && s[u + 1] != s[i]) {

			u = p[u];

		}

		if (s[u + 1] == s[i]) {

			u++;

		}

		p[i] = u;

	}

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

		if (p[i] == 0 || i % (i - p[i]) > 0) {

			f[i] = 1;

		}

	}

}

int main() {

	scanf("%s", s + 1);

	n = strlen(s + 1);

	gao(f);

	if (f[n]) {

		printf("1\n1\n");

		return 0;

	}

	reverse(s + 1, s + 1 + n);

	gao(g);

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

		if (f[i] && g[n - i]) {

			cnt++;

		}

	}

	if (cnt == 0) {

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

	} else {

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

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.1832956481766495x):
#include <cmath>

#include <cstdio>

#include <cstring>

#include <algorithm>

using std::min; using std::max;

using std::swap; using std::sort;

typedef long long ll;



template<typename T>

void read(T &x) {

	int flag = 1; x = 0; char ch = getchar();

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

	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();

	x *= flag;

}



const int _ = 5e5 + 10, P = 1e9 + 7;

int n, p[_], s[_]; char c[_];



int chk0(int r) {

	int len = r, now = len % (len - p[r]);

	if(!now) return len / (len - p[r]) == 1;

	return 1;

}



int chk1(int l) {

	int len = n - l + 1, now = len % (len - s[l]);

	if(!now) return len / (len - s[l]) == 1;

	return 1;

}



int main () {

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

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

		int j = p[i - 1];

		while(j && c[j + 1] != c[i]) j = p[j];

		j += c[j + 1] == c[i], p[i] = j;

	}

	std::reverse(c + 1, c + n + 1);

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

		int j = s[i - 1];

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

		j += c[j + 1] == c[i], s[i] = j;

	}

	std::reverse(s + 1, s + n + 1);

	std::reverse(c + 1, c + n + 1);

	int now = n - p[n];

	if(now == 1) return printf("%d\n%d\n", n, 1), 0;

	if(n % now == 0 && n / now > 1) {

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

		int ret = 0;

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

			if(chk0(i) && chk1(i + 1)) ++ret;

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

	} else printf("%d\n%d\n", 1, 1);

	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()

{

	scanf("%s",s);

	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++;

		}

	}	

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

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.197788088298602x):
#include <cmath>

#include <cstdio>

#include <cstring>

#include <algorithm>

using std::min; using std::max;

using std::swap; using std::sort;

typedef long long ll;



template<typename T>

void read(T &x) {

	int flag = 1; x = 0; char ch = getchar();

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

	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();

	x *= flag;

}



const int _ = 5e5 + 10, P = 1e9 + 7;

int n, p[_], s[_]; char c[_];



int chk0(int r) {

	int len = r, now = len % (len - p[r]);

	if(!now) return len / (len - p[r]) == 1;

	return 1;

}



int chk1(int l) {

	int len = n - l + 1, now = len % (len - s[l]);

	if(!now) return len / (len - s[l]) == 1;

	return 1;

}



int main () {

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

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

		int j = p[i - 1];

		while(j && c[j + 1] != c[i]) j = p[j];

		j += c[j + 1] == c[i], p[i] = j;

	}

	std::reverse(c + 1, c + n + 1);

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

		int j = s[i - 1];

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

		j += c[j + 1] == c[i], s[i] = j;

	}

	std::reverse(s + 1, s + n + 1);

	std::reverse(c + 1, c + n + 1);

	int now = n - p[n];

	if(now == 1) return printf("%d\n%d\n", n, 1), 0;

	if(n % now == 0 && n / now > 1) {

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

		int ret = 0;

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

			if(chk0(i) && chk1(i + 1)) ++ret;

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

	} else printf("%d\n%d\n", 1, 1);

	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.266642882304541x):
#include <cmath>

#include <cstdio>

#include <cstring>

#include <algorithm>

using std::min; using std::max;

using std::swap; using std::sort;

typedef long long ll;



template<typename T>

void read(T &x) {

	int flag = 1; x = 0; char ch = getchar();

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

	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();

	x *= flag;

}



const int _ = 5e5 + 10, P = 1e9 + 7;

int n, p[_], s[_]; char c[_];



int chk0(int r) {

	int len = r, now = len % (len - p[r]);

	if(!now) return len / (len - p[r]) == 1;

	return 1;

}



int chk1(int l) {

	int len = n - l + 1, now = len % (len - s[l]);

	if(!now) return len / (len - s[l]) == 1;

	return 1;

}



int main () {

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

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

		int j = p[i - 1];

		while(j && c[j + 1] != c[i]) j = p[j];

		j += c[j + 1] == c[i], p[i] = j;

	}

	std::reverse(c + 1, c + n + 1);

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

		int j = s[i - 1];

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

		j += c[j + 1] == c[i], s[i] = j;

	}

	std::reverse(s + 1, s + n + 1);

	std::reverse(c + 1, c + n + 1);

	int now = n - p[n];

	if(now == 1) return printf("%d\n%d\n", n, 1), 0;

	if(n % now == 0 && n / now > 1) {

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

		int ret = 0;

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

			if(chk0(i) && chk1(i + 1)) ++ret;

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

	} else printf("%d\n%d\n", 1, 1);

	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.266642882304541x):
#include <cmath>

#include <cstdio>

#include <cstring>

#include <algorithm>

using std::min; using std::max;

using std::swap; using std::sort;

typedef long long ll;



template<typename T>

void read(T &x) {

	int flag = 1; x = 0; char ch = getchar();

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

	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();

	x *= flag;

}



const int _ = 5e5 + 10, P = 1e9 + 7;

int n, p[_], s[_]; char c[_];



int chk0(int r) {

	int len = r, now = len % (len - p[r]);

	if(!now) return len / (len - p[r]) == 1;

	return 1;

}



int chk1(int l) {

	int len = n - l + 1, now = len % (len - s[l]);

	if(!now) return len / (len - s[l]) == 1;

	return 1;

}



int main () {

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

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

		int j = p[i - 1];

		while(j && c[j + 1] != c[i]) j = p[j];

		j += c[j + 1] == c[i], p[i] = j;

	}

	std::reverse(c + 1, c + n + 1);

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

		int j = s[i - 1];

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

		j += c[j + 1] == c[i], s[i] = j;

	}

	std::reverse(s + 1, s + n + 1);

	std::reverse(c + 1, c + n + 1);

	int now = n - p[n];

	if(now == 1) return printf("%d\n%d\n", n, 1), 0;

	if(n % now == 0 && n / now > 1) {

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

		int ret = 0;

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

			if(chk0(i) && chk1(i + 1)) ++ret;

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

	} else printf("%d\n%d\n", 1, 1);

	return 0;

} 

//