#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpll vector<pll>
#define vpii vector<pii>
#define umap unordered_map
#define uset unordered_set
#define PQ priority_queue

#define printa(a,L,R) for(int i=L;i<R;i++) cout<<a[i]<<(i==R-1?'\n':' ')
#define printv(a) printa(a,0,a.size())
#define print2d(a,r,c) for(int i=0;i<r;i++) for(int j=0;j<c;j++) cout<<a[i][j]<<(j==c-1?'\n':' ')
#define pb push_back
#define eb emplace_back
#define mt make_tuple
#define fbo find_by_order
#define ook order_of_key
#define MP make_pair
#define UB upper_bound
#define LB lower_bound
#define SQ(x) ((x)*(x))
#define issq(x) (((ll)(sqrt((x))))*((ll)(sqrt((x))))==(x))
#define F first
#define S second
#define mem(a,x) memset(a,x,sizeof(a))
#define inf 1e18
#define E 2.71828182845904523536
#define gamma 0.5772156649
#define nl "\n"
#define lg(r,n) (int)(log2(n)/log2(r))
#define pf printf
#define sf scanf
#define sf1(a)                scanf("%d",&a)
#define sf2(a,b)              scanf("%d %d",&a,&b)
#define sf3(a,b,c)            scanf("%d %d %d",&a,&b,&c)
#define pf1(a)                printf("%d\n",a);
#define pf2(a,b)              printf("%d %d\n",a,b)
#define pf3(a,b,c)            printf("%d %d %d\n",a,b,c)
#define sf1ll(a)              scanf("%lld",&a)
#define sf2ll(a,b)            scanf("%I64d %I64d",&a,&b)
#define sf3ll(a,b,c)          scanf("%I64d %I64d %I64d",&a,&b,&c)
#define pf1ll(a)              printf("%lld\n",a);
#define pf2ll(a,b)            printf("%I64d %I64d\n",a,b)
#define pf3ll(a,b,c)          printf("%I64d %I64d %I64d\n",a,b,c)
#define _ccase printf("Case %lld: ",++cs)
#define _case cout<<"Case "<<++cs<<": "
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; }

#define asche cerr<<"Ekhane asche\n";
#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
#define all(v) v.begin(),v.end()
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define toint(a) atoi(a.c_str())
#define BeatMeScanf ios_base::sync_with_stdio(false)
#define valid(tx,ty) (tx>=0&&tx<n&&ty>=0&&ty<m)
#define one(x) __builtin_popcount(x)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define stree l=(n<<1),r=l+1,mid=b+(e-b)/2
#define fout(x) fixed<<setprecision(x)
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
inline void yes(){cout<<"YES\n";exit(0);}
inline void no(){cout<<"NO\n";exit(0);}
template <typename T> using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//ll dx[]={1,0,-1,0,1,-1,-1,1};
//ll dy[]={0,1,0,-1,1,1,-1,-1};
//random_device rd;
//mt19937 random(rd());
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); deb(_it, args); }
void deb(istream_iterator<string> it) {}
template<typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    deb(++it, args...);
}

const int mod=1e9+7;
const int N=3e5+9;
const ld eps=1e-9;
const ld PI=acos(-1.0);
//ll gcd(ll a,ll b){while(b){ll x=a%b;a=b;b=x;}return a;}
//ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//ll qpow(ll n,ll k) {ll ans=1;assert(k>=0);n%=mod;while(k>0){if(k&1) ans=(ans*n)%mod;n=(n*n)%mod;k>>=1;}return ans%mod;}


///There can be at most n unique palindromes for a string of size n
struct node             ///a node is a palindromic substring of the string
{
    int nxt[26];        ///link to the palindrome which is formed by adding
                        ///next[i] in both side of this palindrome
    int len;            ///length of the palindrome
    int st,en;          ///starting and ending index of the node
    int suflink;        ///link to the maximum proper suffix palindrome of the node
    int cnt;            ///stores the length of the suffix link chain from it (including this node)
                        ///i.e. the number of palindromic suffix of this node
    int oc;             ///stores the number of occurrence of the node
    int diff;           ///difference diff[v] = len[v]−len[suflink[v]]
    int serieslink;     ///longest suffix-palindrome of v having the difference unequal to diff[v].
};
string s;
node t[N];
int n;                  ///size of string
int sz;                 ///indicates size of the tree
int suf;                ///index of maximum suffix palindrome
void init()
{
    t[1].diff=t[2].diff=0;
    sz=2,suf=2;
    t[1].len=-1,t[1].suflink=t[1].serieslink=1;  ///node 1- root with length -1
    t[2].len=0,t[2].suflink=1;t[2].serieslink=2;  ///node 2- root with length 0 i.e null palindrome
}
/// return if creates a new palindrome
int add_letter(int pos)
{
    ///find the maximum suffix of the prefix+s[pos]
    int cur=suf,curlen=0;
    int ch=s[pos]-'a';
    while(1){
        curlen=t[cur].len;
        if(pos-1-curlen>=0&&s[pos-1-curlen]==s[pos]) break;
        cur=t[cur].suflink;
    }
    ///if the node is not created yet then create the new node
    if(t[cur].nxt[ch]){
        suf=t[cur].nxt[ch];
        t[suf].oc++;
        return 0;
    }
    sz++;
    suf=sz;
    t[sz].oc=1;
    t[sz].len=t[cur].len+2;
    t[cur].nxt[ch]=sz;
    t[sz].en=pos;
    t[sz].st=pos-t[sz].len+1;
    if(t[sz].len==1){
        t[sz].diff=1;
        t[sz].serieslink=2;
        t[sz].suflink=2;
        t[sz].cnt=1;
        return 1;
    }
    while(1){
        cur=t[cur].suflink;
        curlen=t[cur].len;
        if(pos-1-curlen>=0&&s[pos-1-curlen]==s[pos]){
                t[sz].suflink=t[cur].nxt[ch];
                break;
        }
    }
    t[sz].cnt=1+t[t[sz].suflink].cnt;
    t[sz].diff=t[sz].len-t[t[sz].suflink].len;
    if(t[sz].diff==t[t[sz].suflink].diff) t[sz].serieslink=t[t[sz].suflink].serieslink;
    else t[sz].serieslink=t[sz].suflink;
    return 1;
}

int ans[N][2],dp[N][2],kfact[N];

int getmin(int pos,int v,int k)
{
    dp[v][k]=ans[pos-t[v].len][k];
    if (t[v].diff == t[t[v].suflink].diff){
        dp[v][k] = min(dp[v][k], dp[t[v].suflink][k]);
        dp[v][k] =min(dp[v][k], ans[pos - t[t[v].serieslink].len- t[v].diff][k]);
    }
    return dp[v][k] + 1;
}

void calc(int pos,int cur)
{
    pos++;
    ans[pos][0]=1e9;
    ans[pos][1]=1e9;
    for(int v=cur;t[v].len>0;v=t[v].serieslink){
        ans[pos][0]=min(ans[pos][0],getmin(pos,v,1));
        ans[pos][1]=min(ans[pos][1],getmin(pos,v,0));
    }
}

///ans[i][0]=minimal even k (or −2 if it doesn’t exist) such that
///we can split string s[1.. i] into k palindromes.

///ans[i][1]=minimal odd k (or −1 if it doesn’t exist) such that
///we can split string s[1.. i] into k palindromes.

///k-palindrome factorization=splitting  the string into k non-empty non-intersecting palindromes

///minimum palindrome factorization=minimum k such that k-palindrome factorization exist

int main()
{
    BeatMeScanf;
    int i,j,k,n,m;
    cin>>s;
    n=s.size();
    init();
    ans[0][1]=1e9;
    dp[2][1]=1e9;
    for(i=0;i<n;i++){
        add_letter(i);
        calc(i,suf);
    }
    for(i=1;i<=n;i++) cout<<(ans[i][1]==1e9?-1:ans[i][1])<<' '<<(ans[i][0]==1e9?-2:ans[i][0])<<nl;

    ///minimum palindrome factorization
    int res=min(ans[n][0],ans[n][1]);
    cout<<res<<nl;

    ///if k-palindrome factorization is possible or not
    for(i=ans[n][1];i<=n;i+=2) kfact[i]=1;
    for(i=ans[n][0];i<=n;i+=2) kfact[i]=1;
    for(i=1;i<=n;i++) cout<<(kfact[i]?"YES\n":"NO\n");
    return 0;
}
