Problem:
Score : 900 points

Problem Statement

Let x be a string of length at least 1.
We will call x a good string, if for any string y and any integer k (k \geq 2), the string obtained by concatenating k copies of y is different from x.
For example, a, bbc and cdcdc are good strings, while aa, bbbb and cdcdcd are not.

Let w be a string of length at least 1.
For a sequence F=(\,f_1,\,f_2,\,...,\,f_m) consisting of m elements,
we will call F a good representation of w, if the following conditions are both satisfied:

For any i \, (1 \leq i \leq m), f_i is a good string.

The string obtained by concatenating f_1,\,f_2,\,...,\,f_m in this order, is w.

For example, when w=aabb, there are five good representations of w:

(aabb)

(a,abb)

(aab,b)

(a,ab,b)

(a,a,b,b)

Among the good representations of w, the ones with the smallest number of elements are called the best representations of w.
For example, there are only one best representation of w=aabb: (aabb).

You are given a string w. Find the following:

the number of elements of a best representation of w

the number of the best representations of w, modulo 1000000007 \, (=10^9+7)

(It is guaranteed that a good representation of w always exists.)

Constraints

1 \leq |w| \leq 500000 \, (=5 \times 10^5)

w consists of lowercase letters (a-z).

Partial Score

400 points will be awarded for passing the test set satisfying 1 \leq |w| \leq 4000.

Input

The input is given from Standard Input in the following format:

w

Output

Print 2 lines.

In the first line, print the number of elements of a best representation of w.

In the second line, print the number of the best representations of w, modulo 1000000007.

Sample Input 1

aab

Sample Output 1

1
1

Sample Input 2

bcbc

Sample Output 2

2
3

In this case, there are 3 best representations of 2 elements:

(b,cbc)

(bc,bc)

(bcb,c)

Sample Input 3

ddd

Sample Output 3

3
1

Solution in C++14 (GCC 5.4.1) (judge verdict: Runtime Error)

#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9+7;
//const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), outendl())
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}


vector<int> make_primes(int MAX_NUM){
	vector<bool> flag(MAX_NUM+1, true);
	vector<int> res;
	for(int i=2;i<=MAX_NUM;++i){
		if(flag[i]){
			res.push_back(i);
			for(int j=i*2;j<=MAX_NUM;j+=i){
				flag[j] = false;
			}
		}
	}
	return res;
}

bool check(string str){
	int n = str.size();
	for(int i=2;i<n;++i){
		if(n%i!=0)continue;
		int d = n / i;
		bool flag = true;
		for(int j=d;j<n;j+=d){
			if(str.substr(0, d)!=str.substr(j, d)){
				flag = false;
				break;
			}
		}
		if(flag)return true;
	}
	return false;
}

bool allequal(string str){
	foreach(i, str){
		if(i!=str.front())return false;
	}
	return true;
}
int main(){
	string str;
	cin >> str;
	int n = str.size();
	vector<int> primes = make_primes(n);

	if(allequal(str)){
		cout << n << endl;
		cout << 1 << endl;
		return 0;
	}

	if(!check(str)){
		cout << 1 << endl;
		cout << 1 << endl;
		return 0;
	}
	foreach(i, primes){
		if(i==n){
			cout << 1 << endl;
			cout << 1 << endl;
			return 0;
		}
	}
	primes.insert(primes.begin(), 1);
	if((~n)&1){
		int ans = 0;
		repa(i, n){
			if(check(str.substr(0, i)))continue;
			if(check(str.substr(i, n-i)))continue;
			++ans;
		}
		cout << 2 << endl;
		cout << ans << endl;
		return 0;
	}else{
		int ans = 0;
		rep(i, n){
			if(check(str.substr(0, i)))continue;
			if(check(str.substr(i, n-i)))continue;
			++ans;
		}
		if(ans){
			cout << 2 << endl;
			cout << ans << endl;
		}
		return 1;
	}
	return 0;
}