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: Accepted)

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define N 500010
int c[2][N];
int n;
string s;

void ZAlgo(string &s, vector<int> &z){
	int n = s.size();
	z = vector<int>(n);
	z[0] = n;
	int i = 1, j = 0;
	while(i < n){
		while(i+j < n && s[j]==s[i+j]) j++;
		z[i] = j;
		if(j==0){
			i++;
			continue;
		}
		int k = 1;
		while(i+k < n && k+z[k]<j) z[i+k] = z[k], k++;
		i += k;
		j -= k;
	}
}

int main(){
	cin>>s;
	n = s.size();
	rep(k, 2){
		vector<int> z;
		ZAlgo(s, z);
		for(int i = 1; i <= n/2; i++){
			if(c[k][i]) continue;
			for(int j = 2*i; j <= n; j+=i){
				if(z[j-i]>=i) c[k][j] = 1;
				else break;
			}
		}
		reverse(all(s));
	}

	reverse(c[1], c[1]+n+1);

	if(!c[0][n]){
		cout<<1<<endl;
		cout<<1<<endl;
	} else if(s==string(n, s[0])){
		cout<<n<<endl;
		cout<<1<<endl;
	} else {
		cout<<2<<endl;
		int sum = 0;
		for(int i = 0; i <= n; i++) if(!c[0][i]&&!c[1][i]) sum++;
		cout<<sum<<endl;
		//for(int i = 0; i <= n; i++) cout<<c[i]<<" "<<c2[i]<<endl;
	}
	return 0;
}