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: Wrong Answer)

#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
typedef unsigned long long ull;
const int inf=1039074182;
const int mod=1e9+7;
using namespace std;
char c[5000005];
int n;
int fail[5000005];
int rfail[5000005];
char rc[5000005];

void build()
{
	int j=fail[0]=-1;
	for(int i=1;i<=n;i++)
	{
		while(j>=0 && c[i-1]!=c[j]) j=fail[j];
		j++;
		fail[i]=j;
	}
}

void rbuild()
{
	int j=rfail[0]=-1;
	for(int i=1;i<=n;i++)
	{
		while(j>=0 && rc[i-1]!=rc[j]) j=rfail[j];
		j++;
		rfail[i]=j;
	}
}

int main()
{
//	freopen("input.txt","r",stdin);
	scanf("%s",c);
	n=strlen(c);
	for(int i=0;i<n;i++)
	{
		rc[i]=c[n-i-1];
	}
	bool f=true;
	for(int i=0;i<n;i++)
	{
		if(c[i]!=c[0]) f=false;
	}
	if(f)
	{
		cout<<n<<endl<<1<<endl;
		return 0;
	}
	build();
	rbuild();
	int p=n-fail[n];
	if(n%p==0 && n!=p)
	{
		int res=0;
		for(int i=1;i<n;i++)
		{
			if((i)%(i-fail[i])==0 && (i)!=(i-fail[i]) || i%(n-i-rfail[n-i])==0 && n-i!=n-i-rfail[n-i]) continue;
			res++;
		}
		cout<<2<<endl<<res<<endl;
//		cout<<2<<endl;
//		cout<<(1LL*(n/p)*(p-1)+(n/p==2?1:0))%mod<<endl;
	}
	else
	{
		cout<<1<<endl<<1<<endl;
	}
	return 0;
}