QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#837665#8701. BorderCuFeO491 877ms150936kbC++174.5kb2024-12-30 11:11:352024-12-30 11:11:35

Judging History

你现在查看的是最新测评结果

  • [2024-12-30 11:11:35]
  • 评测
  • 测评结果:91
  • 用时:877ms
  • 内存:150936kb
  • [2024-12-30 11:11:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t,p) for(int i = s;i <= t;i += p)
#define drep(i,s,t,p) for(int i = s;i >= t;i -= p)
namespace IO{
    #ifdef LOCAL
    FILE*Fin(fopen("in.in","r")),*Fout(fopen("out.out","w"));
    #else
    FILE*Fin(stdin),*Fout(stdout);
    #endif
    class qistream{static const size_t SIZE=1<<22,BLOCK=64;FILE*fp;char buf[SIZE];int p;public:qistream(FILE*_fp=stdin):fp(_fp),p(0){fread_unlocked(buf+p,1,SIZE-p,fp);}void flush(){memmove(buf,buf+p,SIZE-p),fread_unlocked(buf+SIZE-p,1,p,fp),p=0;}qistream&operator>>(char&str){str=getch();while(isspace(str))str=getch();return*this;}template<class T>qistream&operator>>(T&x){x=0;p+BLOCK>=SIZE?flush():void();bool flag=false;for(;!isdigit(buf[p]);++p)flag=buf[p]=='-';for(;isdigit(buf[p]);++p)x=x*10+buf[p]-'0';x=flag?-x:x;return*this;}char getch(){return buf[p++];}qistream&operator>>(char*str){char ch=getch();while(ch<=' ')ch=getch();for(int i=0;ch>' ';++i,ch=getch())str[i]=ch;return*this;}}qcin(Fin);
    class qostream{static const size_t SIZE=1<<22,BLOCK=64;FILE*fp;char buf[SIZE];int p;public:qostream(FILE*_fp=stdout):fp(_fp),p(0){}~qostream(){fwrite_unlocked(buf,1,p,fp);}void flush(){fwrite_unlocked(buf,1,p,fp),p=0;}template<class T>qostream&operator<<(T x){int len=0;p+BLOCK>=SIZE?flush():void();x<0?(x=-x,buf[p++]='-'):0;do buf[p+len]=x%10+'0',x/=10,++len;while(x);for(int i=0,j=len-1;i<j;++i,--j)swap(buf[p+i],buf[p+j]);p+=len;return*this;}qostream&operator<<(char x){putch(x);return*this;}void putch(char ch){p+BLOCK>=SIZE?flush():void();buf[p++]=ch;}qostream&operator<<(char*str){for(int i=0;str[i];++i)putch(str[i]);return*this;}}qcout(Fout);
}using namespace IO;
#define cin qcin
#define cout qcout
using ll = long long;using ull = unsigned long long;
using db = long double;using ldb = long double;
const int N = 2e6 + 10;
const ull base = 2707;
int n,m,ans[N];ull pw[N];
char s[N],t[N];
struct Hash{
  ull h[N];int n;
  inline void init(char *s,int len){
    n = len;
    rep(i,1,n,1) h[i] = h[i-1]*base + s[i];
  }
  inline ull get(int l,int r){return h[r] - h[l-1]*pw[r-l+1];}
}hs;
set<int> st;
inline void getoriginal(){
  rep(len,1,n-1,1) if(hs.get(1,len) == hs.get(n-len+1,n)) st.emplace(len);
}
struct Segment_Tree{
  struct node{
    int l,r,len;ull val;
    node(){}
    node(int L,int R,int N,ull V):l(L),r(R),len(N),val(V){}
#define l(x) t[x].l
#define r(x) t[x].r
#define len(x) t[x].len
#define val(x) t[x].val
  }t[N<<2];
  inline ull M(int x,int y){return val(x)*pw[len(y)]+val(y);}
  struct Qn{int len;ull val;Qn(int L,ull V){len = L,val = V;}};
  inline Qn Mg(Qn x,Qn y){return Qn(x.len + y.len,x.val*pw[y.len] + y.val);}
  inline void P(int k){t[k].val = M(k<<1,k<<1|1);}
  void B(int k,int l,int r){
    l(k) = l,r(k) = r;len(k) = r - l + 1;
    if(l == r) return val(k) = s[l],void();
    int mid = (l + r) >> 1;
    B(k<<1,l,mid);B(k<<1|1,mid+1,r);P(k);
  }
  void upd(int k,int pos,char x){
    if(l(k) == r(k)) return val(k) = x,void();
    int mid = (l(k) + r(k)) >> 1;
    pos <= mid?upd(k<<1,pos,x):upd(k<<1|1,pos,x);P(k);
  }
  Qn qry(int k,int l,int r){
    if(l <= l(k) && r(k) <= r) return Qn(t[k].len,t[k].val);
    int mid = (l(k) + r(k)) >> 1;
    if(r <= mid) return qry(k<<1,l,r);
    if(l > mid) return qry(k<<1|1,l,r);
    return Mg(qry(k<<1,l,mid),qry(k<<1|1,mid+1,r));
  }
#undef l
#undef r
#undef val
#undef len
}sgt;
signed main(){
  // cin.tie(nullptr)->sync_with_stdio(false);
  cin>>(s+1)>>(t+1);n = strlen(s+1);
  pw[0] = 1;rep(i,1,n,1) pw[i] = pw[i-1]*base;
  hs.init(s,n);sgt.B(1,1,n);
  getoriginal();
  ans[0] = st.size()?*st.rbegin():0;
  rep(i,1,n,1) if(s[i] == t[i]) ans[i] = ans[0];
  rep(len,1,n,1){
    int l = 1,r = len,p = 0;
    while(l <= r){
      int mid = (l + r) >> 1;
      if(hs.get(1,mid) == hs.get(n-len+1,n-len+mid)){
        p = mid,l = mid + 1;
      }
      else r = mid - 1;
    }
    int r1 = n - len + p + 1;
    int r2 = p + 1;
    if(r1 <= n){
      sgt.upd(1,r1,t[n-len+1+p]);
      if(sgt.qry(1,1,len).val == sgt.qry(1,n-len+1,n).val)
        ans[r1] = max(len,ans[r1]);
      sgt.upd(1,r1,s[n-len+1+p]);
    }
    if(r2 <= n){
      sgt.upd(1,r2,t[r2]);
      if(sgt.qry(1,1,len).val == sgt.qry(1,n-len+1,n).val) 
        ans[r2] = max(len,ans[r2]);
      sgt.upd(1,r2,s[r2]);
    }
  }
  rep(i,1,n,1){
    int res = 0;
    if(s[i] != t[i] && st.size()){
      auto it = st.upper_bound(min(i-1,n-i));
      if(it != st.begin()) it--,res = *it;
    }
    cout<<max(ans[i],res)<<'\n';
  }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 23
Accepted

Test #1:

score: 23
Accepted
time: 0ms
memory: 17896kb

input:

cbaababaabacbaababaabacbaabacbaababaabacbaaba
dabbababbabaabbafabbgbaabfebaabzababbayaabcac

output:

0
0
0
0
0
0
6
6
6
6
6
6
6
6
6
6
6
17
17
17
17
17
17
17
17
17
17
17
6
6
6
6
6
6
6
6
6
6
6
0
0
0
3
0
1

result:

ok 45 numbers

Test #2:

score: 23
Accepted
time: 3ms
memory: 17832kb

input:

cbaababaabacbaabadbaababaabacbaabacbaaba
aabwaxjbbabtalbabcasbabibbabaabbabaabiac

output:

3
0
0
0
0
0
6
6
6
6
6
6
6
6
6
6
6
23
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
0
0
0
0
0
1

result:

ok 40 numbers

Test #3:

score: 23
Accepted
time: 3ms
memory: 17828kb

input:

cadaabacabacabacabaabacabacadaabacabacaba
bbbbbabtbabababalalbawababababbaoababebdc

output:

2
0
4
0
0
0
0
0
0
0
0
0
0
0
0
15
15
15
15
15
15
15
15
15
15
15
0
0
0
0
0
0
0
0
0
0
0
0
0
4
1

result:

ok 41 numbers

Test #4:

score: 23
Accepted
time: 0ms
memory: 17840kb

input:

dabacbaadcbaadabacbaadabecbaadcbaadabacbaadabacbaa
ababaabbyaarbabfbvdbuaoaaaabbaaabbababaabbababqadd

output:

2
0
0
0
0
0
0
0
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
29
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
0
0
0
0
0
0
2
1

result:

ok 50 numbers

Test #5:

score: 23
Accepted
time: 0ms
memory: 17892kb

input:

edacbcacacbcaecbcacacbcadacbcacacbca
sabaaabtbaaabaaalblbawaeabaaababoaae

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
13
0
0
0
0
0
0
0
0
0
0
0
1

result:

ok 36 numbers

Test #6:

score: 23
Accepted
time: 0ms
memory: 17960kb

input:

cbaababaabacbaabacbaabdbaabacbaabacbaaba
aabbababbaoaabbxbaabbaqabbabltbpagaabcac

output:

3
0
0
0
0
0
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
0
0
0
3
0
1

result:

ok 40 numbers

Subtask #2:

score: 31
Accepted

Dependency #1:

100%
Accepted

Test #7:

score: 31
Accepted
time: 0ms
memory: 18276kb

input:

abacadcabbacabbacabcabbacabacabbacabbacabcabbacabbacadcabbacabbacabcabbacabacabbacabbacabcabbacabbacadcabbacabbacabcabbacababacadcabbacabbacabcabbacabacabbacabbacabcabbacabbacadcabbacabbacaecabbacabacabbacabbacabcabbacabbacadcabbacabbacabcabbacababacadcabbacabbacabcabbacabacabbacabbacabcabbacabbacad...

output:

27
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75
75...

result:

ok 4623 numbers

Test #8:

score: 31
Accepted
time: 0ms
memory: 18184kb

input:

gcdcbcacacacbcacdcbcacaedcbcacacacbcacdcfcacacdcbcacaedcbcacacacbcacdcbcacacdcbcacacdcbcacacacbcacdcbcacaedcbcacacacbcacdcbcacacdcbcacacdcbcacacacbcacdcbcacaedcbcacacacbcacdcbcacacdcbcacagcdcbcacacacbcacdcbcacaedcbcacacacbcacdcbcacacdcbcacaedcbcacacacbcacdcbcacacdcbcacacdcbcacacacbcacdcbcacaedcbcaca...

output:

187
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 3182 numbers

Test #9:

score: 31
Accepted
time: 2ms
memory: 18100kb

input:

fbcababaabaababaababdababaabaababaababcababaababcababaabaababaababcababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaababcababaabaababaababdababaabaababaababcababaababcababaabaababaababcababaababcababaabaababaababcababaababcababaabaabebaababda...

output:

103
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 4057 numbers

Test #10:

score: 31
Accepted
time: 0ms
memory: 18272kb

input:

accaeaabacabaabacabacabaabacabaabacdbacabaabacabaabacabacabaabacabaabacdbacabaabacabaabacabacabaabacabacabaabacabaabacabacabaabacabaabacdbacabaabacabaabacabacabaabacabacabaabacabaabacabacabaabacabaabacdbacabaabacabaabacabacabaabacabacabaabacabaabacabacabaabacabaabacdbacabaabacabaabacabacabaabacabaab...

output:

0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 4342 numbers

Test #11:

score: 31
Accepted
time: 5ms
memory: 18220kb

input:

fababaadabcababaababcababaabaababaababcababaabaababaababcababaebabcababaabaababaababcababaababcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaadabcababaababcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaadabcababaababcababaabaababaababcaba...

output:

517
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 3855 numbers

Test #12:

score: 31
Accepted
time: 0ms
memory: 18300kb

input:

hbfdabacabadcabadabacabadcabadabacabadabacabadcabadabacabaecabadabacabadabacabadcabadabacabadcabadabacabadabacabadcabadabacabafecabadabacabadabacabadcabadabacabadcabadabacabadabacabadcabadabacabafdabacabadcabadabacabadcabadabacabadabacabadcabadabacabaecabadabgcabadabacabadcabadabacabadcabadabacabada...

output:

1661
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 4664 numbers

Test #13:

score: 31
Accepted
time: 0ms
memory: 18280kb

input:

fbcbaaabacbaaabacbaecbaaabacbaaabacbadcbaaabacbaaabacbaacbaaabacbaaabacbadcbaaabacbaaabacbaacbaaabacbaacbaaabacbaaabacbaacbaaabacbaaabacbadcbaaabacbaaabacbaacbaaabacbaaabacbadcbaaabacbaaabacbaacbaaabacbaacbaaabacbaaabacbaacbaaabacbaaabacbadcbaaabacbaaabacbaacbaaabacbaacbaaabacbaaabacbaacbaaabacbaaab...

output:

1633
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 4299 numbers

Test #14:

score: 31
Accepted
time: 5ms
memory: 18336kb

input:

acabbacabbacabcabbacabbacadcaebacabbacabcabbacabbacadcabbacabbacabcabbacabcabbacabbacabcabbacabbacadcabbacabbacabcabbacabcabbacabbacabcabbacabbacadcabbacabbacabcabbacabacabbacabbacabcabbacabbacadcabbacabbacabcabbacabbacadcabbacabbacabcabbacabcabbacabbacabcabbacabbacadcabbacabbacabcabbacabcabbacabbac...

output:

168
2
0
0
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
...

result:

ok 4512 numbers

Test #15:

score: 31
Accepted
time: 0ms
memory: 18084kb

input:

afabacabacabaabacabaabadabacabaabacabaabacabaabadabacabaabacabaabacabaabacabacabaabacabaabadabacabaabacabaabacabaabadabacabaabecabaabacabaabacabacabaabacabaabadabacabaabacabaabacabaabadabacabaabacabaabacabaabacabacabaabacabaabadabacabaabacabaabacabafabadabacabaabecabaabacabaabacabacabaabacabaabadaba...

output:

0
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 3912 numbers

Test #16:

score: 31
Accepted
time: 4ms
memory: 18172kb

input:

cbdaabacbaecbaacbaaabacbaacbdaabacbaacbaacbdaabacbaacbaacbaaabacbaacbdaabacbaacbaacbaaabacbaacbdaabacbaacbaacbdaabacbaacbaacbaaabacbaacbdaabfcbaacbaacbdaabacbaecbaacbaaabacbaacbdaabacbaacbaacbdaabacbaacbaacbaaabacbaacbdaabacbaacbaacbaaabacbaacbdaabacbaacbaacbdaabacbaacbaacbaaabacbaacbdaabacbaacbaacb...

output:

1
0
4
0
0
0
0
0
0
0
41
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
82
...

result:

ok 3435 numbers

Test #17:

score: 31
Accepted
time: 0ms
memory: 18112kb

input:

dcbeacacbcadcacbcadcbcacacbcadcbcacacbcadcacbcadcbcacfcbcadcacbcadcbcacacbcadcbcacacbcadcacbcadcbcacacbcadcbeacacbcadcacbcadcbcacacbcadcbcacacbcadcacbcadcbcacacbcadcbeacacbcadcacbcadcbcacacbcadcbcacacbcadcacbcadcbcacacbcadcbeacacbcadcacbcadcbcacacbcadcbcacacbcadcacbcadcbcacacbcadcacbcadcbcacacbcadcb...

output:

1
0
0
29
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
58
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 3688 numbers

Subtask #3:

score: 37
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #18:

score: 37
Accepted
time: 29ms
memory: 27280kb

input:

gcbacbbdacbbbacbacbbbacbacbbbacbacbbbacbbbacbacbbbacbacbbdacbbbacbacbbbacbacbbbacbacbbdacbbbacbacbbbacbaebbbacbacbbbacbbbacbacbbbacbacbbdacbbbacbacbbbacbacbbbacbacbbdacbbbacbacbbbacbacbbbacbacbbdacbbbacbacbbbacbaebbbacbacbbbacbbbacbacbbbacbacbbdacbbbacbacbbbacbacbbbacbacbbdacbbbacbacbbbacbacbbbacbac...

output:

188
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 61972 numbers

Test #19:

score: 37
Accepted
time: 39ms
memory: 25156kb

input:

afcbdaabacbaacbaaabacbaaabacbaacbaaabacbaacbdaabacbaacbaaabacbaaabacbaacbaaabacbaacbdaabacbaacbaaabacbaacbdaabacbaacbaaabacbaaabacbaacbaaabacbaacbdaabacbaacbaaabacbaaabacbaacbaaabecbaacbdaabacbaacbaaabacbaacbdaabacbaacbaaabacbaaabacbaacbaaabacbaacbdaabacbaacbaaabacbaaabacbaacbaaabacbaacbdaabacbaacba...

output:

0
166
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 79055 numbers

Test #20:

score: 37
Accepted
time: 38ms
memory: 24284kb

input:

gcbaaaabaabaabaaaabacbaaaabaabaabaaaabacbaaaabaabacbaaaabaabaabaaaabacbaaaabaabaabaaaabdcbaaaabaabacbaaaabaabaabaaaabacbaaaabaabaabaaaabacbaaaabaabacbaaaabaabaabaaaabacbaaaabaabaabaaaabdcbaaaabaabacbaaaabaabaabaaaabacbaaaabaabaabaaaabacbaaaabaabacbaaaabaabaabaaaabacbaaaabaabacbaaaabaabaabaaaabacbaaa...

output:

2555
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 89092 numbers

Test #21:

score: 37
Accepted
time: 42ms
memory: 25204kb

input:

ieabacbaacbafabacbaaabacbdacbaaabacbaaabacbaaeabacbdacbaaabacbaaabacbaaeabacbaacbaaabacbaaabacbdacbaaabacbaaabacbaaeabacbaacbaaabacbaaabacbdacbaaabacbaaabacbaaeabacbdacbaaabacbaaabacbaaeabacbaacbaaabacbaaabacbdacbaaabacbaaabacbaaeabacbdacbaaabacbaaabacbaaeabacbaacbaaabacbaaabacbdacbaaabacbaaabacbaae...

output:

3885
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 83355 numbers

Test #22:

score: 37
Accepted
time: 39ms
memory: 25168kb

input:

fcdbbacabcabbecabbacabcabbacabcdbbacabcabbacabcdbbacabcabbacabcdbbacabcabbacabbacabcabbacabcdbbacabcabbacabcdbbacabcabbecabbacabcabbacabcdbbacabcabbacagcdbbacabcabbacabfcdbbacabcabbacabbacabcabbacabcdbbacabchbbacabcdbbacabcabbecabbacabcabbacabcdbbacabcabbacabcdbbacabcabbacabfcdbbacabcabbecabbacabcab...

output:

62
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 91682 numbers

Test #23:

score: 37
Accepted
time: 30ms
memory: 22304kb

input:

adabacbaadcbaadabacbaadabaceaadcbaadabacbaafabacbaadabaceaadcbaadabacbaadabacbaadabacbaadcbaadabacbaadabaceaadcbaadhbacbaadabacbaadabacbaadcbaadabacbaadabaceaadcbaadabacbaadabacbaadabacbaadcbaadabacbaadabaceaadcbaadabacbaadabacbaadabaceaadcbaadabacbaadabacbaadabacbaadcbaadabacbaadabaceaadcbaadabacba...

output:

0
2
1
1
1
1
1
1
1
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
51
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
1154
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
...

result:

ok 63269 numbers

Test #24:

score: 37
Accepted
time: 50ms
memory: 29888kb

input:

bdcabcabbacabbacabcaebacabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabbdcabcabbacabbacabcaebacabcabbacab...

output:

0
13
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
73
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
146
14...

result:

ok 99060 numbers

Test #25:

score: 37
Accepted
time: 42ms
memory: 29632kb

input:

aababaabebcababadbabcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaababcababadbabcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaababcababadbabcababaabaababaababcaba...

output:

2
1
1
1
4
4
4
4
93
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4...

result:

ok 82370 numbers

Test #26:

score: 37
Accepted
time: 43ms
memory: 31356kb

input:

cdbaeacbacbacbacacbadbacacbacbadbacacbacbacdbacacbacbacbacacbadbacacbacbadbaeacbacbacbacacbadbacacbacbadbacacbacbacdbacacbacbacbacacbadbacacbacbadbaeacbacbacbacacbadbacacbacbadbacacbacbacdbaeacbacbacbacacbadbacacbacbadbacacbacbacdbacacbacbacbacacbadbacacbacbadbaeacbacbacbacacbadbacacbacbadbacacbacba...

output:

42
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
114
114
114
114
114
114
114
114
114
114
114
114
114
114
114
114
114
114...

result:

ok 93324 numbers

Test #27:

score: 37
Accepted
time: 45ms
memory: 26740kb

input:

bbabbbabcbbbababbcbbbdbababbbabcbbbababbcbbbabababbbabcbbbababbabbbabcbbbababbcbbbabababbbabcbbbababbabbbabcbbbababbcbbbabababbbabcbbbababbcbbbabababbbabcbbbfbabbabbbabcbbbababbcbbbabababbbabcbbbababbcbbbabababbbabcbbbababbabbbabcbbbababbcbbbabababbbabcbbbababbabbbabcbbbababbcbbbabababbbabcbbbababbc...

output:

15
2
0
0
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
99
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 80812 numbers

Test #28:

score: 37
Accepted
time: 43ms
memory: 24300kb

input:

ebcadbbacabbbacabbcabbbacabbcabbbacabbbacabbcabbbacabbbacabbcabbbacabbcabbbacabbbacabbcabbbacabbcadbbacabbbacabbcabbbacabbcabbbacabbbacabbcabbbacabebbacabbcabbbacabbcabbbacabbbacabbcabbbacabbcadbbacabbbacabbcabbbacabbcabbbacabbbacabbcabbbacabebcadbbacabbbacabbcabbbacabbcabbbacabbbacabbcabbbacabbbaca...

output:

53
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
147
1...

result:

ok 83614 numbers

Test #29:

score: 37
Accepted
time: 38ms
memory: 27760kb

input:

abbdbababbbacabbbababbbacabbbababbbabbbaeabbbacabbbababbbabbbababbbacabbbababbbacabbbababbbabbbababbbacabbbababbbacabbbababbbabbbababbbacabbbababbbabbbababbbacabbbababbbacabbbababbbabbbababbbacabbbababbbabdbababbbacabbbababbbacabbbababbbabbbababbbacabbbababbbabbbababbbacabbbababbbacabbbababbbabbbaba...

output:

0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 68245 numbers

Test #30:

score: 37
Accepted
time: 31ms
memory: 25180kb

input:

cbaababaabacbaababaabacbaabacbaababaabacbaababaabacdaabacbaababaabacbaababaabacbaabacbaababaabacbaababaabacdaabacbaababaabacbaababaabacbaabacbaababaabacbaabacbaababaabacbaababaabacbaabacbaababaabacbaababaabacdaabacbaababaabacbaababaabacbaabacbaababaabacbaababaabacdaabacbaababaabacbaababaabacbaabacba...

output:

3
0
0
0
0
0
6
6
6
6
6
6
6
6
6
6
6
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
45
101
101
101
10...

result:

ok 71812 numbers

Test #31:

score: 37
Accepted
time: 39ms
memory: 26644kb

input:

ebbcabababbaababcabababbaabfbcabababbcabababbaababcabababbaababcadababbcabababbaababcabababbaababcabababbcabababbaababcababaebbaababcadababbcabababbaababcabababbaababcabababbcabababbaababcababaebbcabababbaababcabababbaababcabababgcabababbaababcabababbaababcadababbcabababbaababcabababbaababcabababbca...

output:

22
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
124
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 89746 numbers

Test #32:

score: 37
Accepted
time: 39ms
memory: 29504kb

input:

adabacabedcabadabacfbadabacabadcabadabacabadcabadabacabadabacabadcabadabacabadabacabedcabadabacabadabacabadcabadabacabadabacabedcabadabacabadabacabadcabadabacabadcabadabacabadabacabadcabadabacabadabacabedcabadabacabadabacabadcabadabacabadcabadabacabadabacabadcabadabacabadabacabedcabadabacabadabacaba...

output:

0
5
1
1
1
1
1
1
9
1
1
1
1
1
1
1
1
1
1
119
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 86655 numbers

Test #33:

score: 37
Accepted
time: 44ms
memory: 29712kb

input:

cbaabaababaababcabaababaababaababcabaababaababaababaabaababaababcabaababaababaababcabaababaabadaababaabaababaababcabaababaababaababcabaababaababaababaabaababaababcabaababaababaababcabaababaabadaababaabaababaababcabaababaababaababcabaababaababaababaabaababaababcabaababaababaababaabaababaababcabaababa...

output:

6749
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 99407 numbers

Test #34:

score: 37
Accepted
time: 37ms
memory: 24840kb

input:

cbadaeacbaacbaacbaaabacbaacbadabacbaacbaacbadabacbaacbaacbaaabacbaafbadabacbaacbaacbaaabacgaacbadabacbaacbaacbadabacbaacbaacbaaabacbaacbadabacbaacbaacbadaeacbaacbaacbaaabacbaacbadabacbaacbaacbadabacbaacbaacbaaabacbaacbadabacbaacbaacbadaeacbaacbaacbaaabacbaacbadabacbaacbaacbadabacbaacbaacbaaabacbaacb...

output:

1
0
0
4
0
41
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
82
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
462
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 76996 numbers

Subtask #4:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #35:

score: 9
Accepted
time: 877ms
memory: 150068kb

input:

akhebabacbaacbaaabacbaacdaaabacbaacbaaabacbaabcdaaafacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaaebcdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaabcdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaaebcdaaabacbaacbaaabac...

output:

0
102242
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

result:

ok 1513306 numbers

Test #36:

score: 9
Accepted
time: 764ms
memory: 146644kb

input:

bacbaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababacbaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababacbaababdabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaab...

output:

1
0
34
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
6...

result:

ok 1324378 numbers

Test #37:

score: 9
Accepted
time: 784ms
memory: 149452kb

input:

ahccbaababdabacbaababeabacbaabacbaababaabacbaabacbaababaabacbaabacbaababaabacbaababaabacbaabacbaababaabacbaabacbaababdabacbaababaabacbaabacbaababaabacbaabacbaababaabacbaabacbaababdabacbaababaabacbaabacbaababaabacbaabacbaababaabacbaabafbaababdabacbaababaabacbaabacbaababaabacbaabacbaababaabacbaabacbaa...

output:

0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 1367001 numbers

Test #38:

score: 9
Accepted
time: 806ms
memory: 150876kb

input:

jigdbaeabdcabbacabdcabbacabdbacabdcabbacabdcabbacabdbacabdcabbacabdbacabdcabbacabdcabbacabdbacabdcabbacabdbacabdcabbacabdcabbacabdbacabdcabbacabdcabbacabdbacabdcabbacabdbacabdcabbacabdcabbacabdbacabdcabbacabdcabbacabdbacabdcabbacabdbacabdcabbacabdcabbacabdbacabdcabbacabdbacabdcabbacabdcabbacabdbacab...

output:

56052
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1445555 numbers

Test #39:

score: 9
Accepted
time: 858ms
memory: 150936kb

input:

badbacebdcabdbacabdbacabdcabdbacabadcabdbacabdbacabdcabdbacabdbacebdcabdbacabdbacabdcabdbacabadcabdbacabdbacabdcabdbacabdbacebdcabdbacabdbacabdcabdbacabadbacebdcabdbacabdbacabdcabdbacabadcabdbacabdbacabdcabdbacabdbacebdcabdbacabdbacabdcabdbacabadcabdbacabdbacabdcabdbacabdbacebdcabdbafabdbacabdcabdba...

output:

0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
...

result:

ok 1499064 numbers

Test #40:

score: 9
Accepted
time: 735ms
memory: 145820kb

input:

fabacabcabbacabdacabcabbacabbacabadacabcabbacabbacababacabcabbacabdacabcabbacabbacabadacabcabbacabbacababacabcagbacabdacabcabbacabbacababacabcabbacabdacabcabbacabbacabadacabcabbacabbacababacabcabbacabdacabcabbacabbacabadacabcabbacabbacababacabcabbacabdaeabcabbacabbacababacabcabbacabdacabcabbacabbaca...

output:

84
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
486
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 1309306 numbers

Test #41:

score: 9
Accepted
time: 744ms
memory: 148652kb

input:

khagbaabcababaababaabadbabaabaababaababaabaababaababaabcababaababaabaababaababaabcababaababaabaababaabaababaababaabaababaababaabcababaababaabaababaabaababaababaabaababaababaabcababaababaabaababaababaabcababaababaabaababaabaababaababaabaababaababaabcababaababaabaababaababaabcababaababaabadbabaabaabab...

output:

190327
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 1369239 numbers

Test #42:

score: 9
Accepted
time: 799ms
memory: 147700kb

input:

abcecabaabacabacdbaabacabacabaecdbaabacabacabaecabaabacabacdbaabacabacabaecdbaabacabacabaecabaabacabacdbaabacabacabaecabaabacabacdbaabacabacabaecdbaabacabacabaecabaabacabacdbaabacabacabaecdfaabacabacabaecabaabacabacdbaabacabacabaecabaabacabacdbaabacabacabaecdbaabacabacabaecabaabacabacdbaabacabacabae...

output:

0
1
1047
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

result:

ok 1411843 numbers

Test #43:

score: 0
Time Limit Exceeded

input:

ceacabcabbacabcabbacabbacabcabbacabcabbadabbacabcabbacabcabbacabbacabcabbacabcabbadabbacabcabbacabcabbacabbacabcabbacabbacabcabbacabcabbacabbacabcabbacabcabbadabbacabcabbacabcabbacabbacabcabbacabbacabcabbacabcabbacabbacabcabbacabcabbadabbacabcabbacabcabbacabbacabcabbacabbacabcabbacabcabbacabbacabcab...

output:


result: