Language: C++

#include <map>
#include <vector>
#include <functional>
#include <iterator>
#include <utility>
#include <array>
#include <cstdio>
namespace XX
{   
    template<template<typename> class Compare, typename T>
    inline T& UP(T& x, const T& y){if(Compare<T>()(y, x)) x = y; return x;}
    template<typename Compare, typename T>
    inline T& UP(T& x, const T& y, Compare comp){if(comp(y, x)) x = y; return x;}

    template<typename T> inline T& GT(T& x, const T& y){return UP<std::greater>(x, y);}
    template<typename T> inline T& LS(T& x, const T& y){return UP<std::less>(x, y);}

    template<typename T>
    struct Mapper
    {
        int operator[](const T& v) { int& ret = table[v]; if(!ret) rtable[ret = table.size()] = v; return ret - 1; }
        template<typename... Args> int operator()(Args... args) { return (*this)[T(args...)]; }
        T rev(int idx){return rtable[idx + 1];}
        std::map<T, int> table;
        std::map<int, T> rtable;
    };

    template<typename T, int S>
    struct ReferenceArray
    {
        struct It {typename std::array<T*, S>::iterator it; T& operator*(){return **it;} void operator++(){it++;} bool operator!=(const It& other){return it != other.it;} };
        int size()const{return _ptr.size();}
        It begin()const{return {_ptr.begin()};}
        It end()const{return {_ptr.end()};}
        T& operator[](int idx)const{return *_ptr[idx];}
        mutable std::array<T*, S> _ptr;
    };
    template<typename T, typename... Args> 
    ReferenceArray<T, sizeof...(Args) + 1> MAKEV(T& arg1, Args&... args) {return {&arg1, &args...};}

    struct Range
    {   
        struct It {   int num, step; int operator*(){return num;} void operator++(){num += step;} bool operator!=(const It& other){return num != other.num;} };
        Range(int ee):b(0),e(ee){}
        Range(int bb, int ee):b(bb), e(ee){}
        It begin(){return {b, (b < e? 1: -1)};}
        It end(){return {e, 0};}
        int b, e;
    };

}



template<typename T> struct ScanfSpecifier{};
#define DEF(T,V) template<> struct ScanfSpecifier<T>{static constexpr const char* value = V;};
DEF(int,"%d")DEF(double,"%lf")DEF(float,"%f")DEF(char,"%c")DEF(const char*,"%s")DEF(unsigned long,"%lu")DEF(char*,"%s")DEF(unsigned int, "%u")
#ifdef _MSC_VER
DEF(long long int,"%I64d")
#else
DEF(long long int,"%lld")
#endif
#undef DEF
template<typename T> int RD(T& arg){return std::scanf(ScanfSpecifier<T>::value, &arg);}
template<int S> int RD(char (&arg)[S]){return std::scanf("%s", arg);}
template<> int RD<char*>(char*& arg){return std::scanf("%s", arg);}
template<> int RD<char>(char& arg){return std::scanf(" %c", &arg);}
template<typename T, typename... Args> int RD(T& arg1, Args&... args) {return RD(arg1) + RD(args...);}
template<typename T> T RD(){T ret; RD(ret); return ret;}
template<typename It> void RDV(It begin, It end) { while(begin != end) RD(*begin++); }
template<typename C> void RDV(C& c) {RDV(std::begin(c), std::end(c));}
template<typename... Args> void WT(Args... args) { int alc = 0; int dummy[] = {((alc++? std::printf(" "): 0), std::printf(ScanfSpecifier<Args>::value, args), 0)...}; }
template<typename... Args> void WTL(Args... args) { WT(args...); std::printf("\n"); }
template<typename It> void WTV(It begin, It end) { int alc = 0; while(begin != end) (alc++? std::printf(" "): 0), WT(*begin++); }
template<typename C> void WTV(const C& c) {WTV(std::begin(c), std::end(c));}
template<typename It> void WTVL(It begin, It end) { WTV(begin, end); std::printf("\n"); }
template<typename C> void WTVL(const C& c) {WTVL(std::begin(c), std::end(c));}


using namespace std;

namespace XX
{
    template<typename RandIt>
    class KMPBody
    {        
        public:

            struct Iter
            {
                int idxP, idxT;
                int matchIdx;
                Iter(int p, int t, const KMPBody& b)
                    :idxP(p), idxT(t), body(b)
                {}
                
                int operator*(){return matchIdx;}
                bool operator!=(const Iter& other){return idxP != other.idxP || idxT != other.idxT;}
                Iter& operator++()
                {
                    while(true)
                    {
                        if(idxP == body._plen)
                        {
                            matchIdx = idxT - body._plen;
                            idxP = body._fail[idxP - 1] + 1;
                            break;
                        }
                        else if(idxT == body._tlen)
                        {
                            idxP = idxT = matchIdx = -1;
                            break;
                        }
                        else if(body._pbegin[idxP] == body._tbegin[idxT])
                        {
                            idxP++;
                            idxT++;
                        }
                        else if(!idxP)
                            idxT++;
                        else
                            idxP = body._fail[idxP - 1] + 1;
                    }
                    return *this;
                }


                const KMPBody& body;
            };



            Iter begin()const {return ++Iter(0, 0, *this);}
            Iter end()const {return Iter(-1, -1, *this);}
            
            KMPBody(RandIt pbegin, int plen, RandIt tbegin, int tlen) 
                :_pbegin(pbegin), _plen(plen), _tbegin(tbegin), _tlen(tlen), _fail(plen)
            {
                if(!plen)
                    return;

                _fail[0] = -1;
                for(int idx = 1; idx < _plen; ++idx)
                {
                    int last = _fail[idx - 1];
                    while(last > -1 && _pbegin[last + 1] != _pbegin[idx])
                        last = _fail[last];

                    if(_pbegin[last + 1] == _pbegin[idx])
                        _fail[idx] = last + 1;
                    else
                        _fail[idx] = -1;
                }
            }
                
        private:
            std::vector<int> _fail;
            RandIt _pbegin, _tbegin;
            int _plen, _tlen;
    };


    //Pattern, Text
    template<typename RandIt>
    KMPBody<RandIt> KMP(RandIt pbegin, int plen, RandIt tbegin, int tlen) 
    {
        return KMPBody<RandIt>(pbegin, plen, tbegin, tlen);
    }
}







//alias
//KMP 
using XX::KMP; // (pattern_begin,pattern_len,text_begin,text_len) enumerate occurrence with range-based loop
//RD[L],RDV[L],WT[L],WTV[L] for i/o
template<typename T> T& UMAX(T& x, T y){return XX::UP<std::greater>(x, y);}
template<typename T> T& UMIN(T& x, T y){return XX::UP<std::less>(x, y);}
using XX::UP; //(x,y) comp
using RG = XX::Range;
using XX::MAKEV;
using XX::Mapper;
//template
#include <vector>
#include <string>
#include <set>
#include <map>
#include <cstdlib>
#include <algorithm>
#include <functional>
using namespace std;

char buf[500009];
char text[1000009];

int main()
{
    RD(buf);

    strcpy(text, buf);
    strcat(text, buf);

    int N = strlen(buf);
    int len = 0;
    for(int idx: KMP(buf, N, text, 2 * N))
        if(idx && idx < N && N % idx == 0)
        {
            len = idx;
            break;
        }
    
    if(!len)
        WTL("1\n1");
    else if(len == 1)
    {
        WTL(N);
        WTL(1);
    }
    else
    {
        WTL(2);
        WTL(N - 1 - (len > 2? N / len - 1: 0));
    }
}





Compiler output:
a.cc: In function 'int main()':
a.cc:204:5: error: 'strcpy' was not declared in this scope
  204 |     strcpy(text, buf);
      |     ^~~~~~
a.cc:194:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  193 | #include <algorithm>
  +++ |+#include <cstring>
  194 | #include <functional>
a.cc:205:5: error: 'strcat' was not declared in this scope
  205 |     strcat(text, buf);
      |     ^~~~~~
a.cc:205:5: note: 'strcat' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:207:13: error: 'strlen' was not declared in this scope
  207 |     int N = strlen(buf);
      |             ^~~~~~
a.cc:207:13: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'