Language: C++

#include <iostream>
#include <vector>
#define llint unsigned long long
#define H 1000000007

using namespace std;

string s;
llint hash[500005];
llint bekiH[500005];
vector<int> vec[500005];

llint get(llint l, llint r)
{
	return hash[r] - hash[l-1]*bekiH[r-l+1];
}

bool check2(int l, int r, int p)
{
	return get(l, r-p) == get(l+p, r);
}

bool check(int l, int r)
{
	int len = r-l+1;
	if(len == 1) return true;
	for(int i = 0; i < vec[len].size(); i++){
		int d = vec[len][i];
		if(d == len) continue;
		if(check2(l, r, d)) return false;
	}
	return true;
}

int main(void)
{
	cin >> s;
	int n = s.size();
	s = "#" + s;
	
	bekiH[0] = 1;
	for(int i = 1; i <= n; i++) bekiH[i] = bekiH[i-1] * H;
	for(int i = 1; i <= n; i++) hash[i] = hash[i-1] * H + s[i];
	
	int cyc = n;
	for(int i = 1; i < n; i++){
		if(n % i == 0 && check2(1, n, i)){
			cyc = i;
			break;
		}
	}
	if(cyc == 1){
		cout << n << endl;
		cout << 1 << endl;
		return 0;
	}
	if(cyc == n){
		cout << 1 << endl;
		cout << 1 << endl;
		return 0;
	}
	
	for(int i = 1; i <= n; i++){
		for(int j = 1; i*j <= n; j++) vec[i*j].push_back(i);
	}
	
	cout << 2 << endl;
	int ans = 0;
	for(int i = 2; i <= n; i++) if(check(1, i-1) && check(i, n)) ans++;
	cout << ans << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'long long unsigned int get(long long unsigned int, long long unsigned int)':
a.cc:15:16: error: reference to 'hash' is ambiguous
   15 |         return hash[r] - hash[l-1]*bekiH[r-l+1];
      |                ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:7: note:                 'long long unsigned int hash [500005]'
    9 | llint hash[500005];
      |       ^~~~
a.cc:15:26: error: reference to 'hash' is ambiguous
   15 |         return hash[r] - hash[l-1]*bekiH[r-l+1];
      |                          ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:7: note:                 'long long unsigned int hash [500005]'
    9 | llint hash[500005];
      |       ^~~~
a.cc: In function 'int main()':
a.cc:43:37: error: reference to 'hash' is ambiguous
   43 |         for(int i = 1; i <= n; i++) hash[i] = hash[i-1] * H + s[i];
      |                                     ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:7: note:                 'long long unsigned int hash [500005]'
    9 | llint hash[500005];
      |       ^~~~
a.cc:43:47: error: reference to 'hash' is ambiguous
   43 |         for(int i = 1; i <= n; i++) hash[i] = hash[i-1] * H + s[i];
      |                                               ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:7: note:                 'long long unsigned int hash [500005]'
    9 | llint hash[500005];
      |       ^~~~