QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#219470#7618. Pattern Searchucup-team1447#AC ✓47ms5488kbC++238.2kb2023-10-19 15:15:382023-10-19 15:15:39

Judging History

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

  • [2023-10-19 15:15:39]
  • 评测
  • 测评结果:AC
  • 用时:47ms
  • 内存:5488kb
  • [2023-10-19 15:15:38]
  • 提交

answer

// dottle bot
#ifndef ONLINE_JUDGE
#define DEBUG
#endif
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <bitset>
#include <map>
#include <assert.h>
#include <math.h>
#include <set>
#define nln puts("")
#define od(x) printf("%d",x)
#define odb(x) printf("%d ",x)
#define odl(x) printf("%d\n",x)
#define odp(x,y) printf("%d %d\n",x,y)
#define ol(x) puts("")
#define old(x) printf("%lld",x)
#define oldb(x) printf("%lld ",x)
#define oldl(x) printf("%lld\n",x)
#define oldp(x,y) printf("%lld %lld\n",x,y)
#define rg(x) for(int i=1;i<=(x);i++){
#define rg_(i,x) for(int i=1;i<=(x);i++){
#define fe(u) for(int i=h[u];i;i=e[i].nxt){int v=e[i].v;
#define gr }
#define rrg(x) for(int i=0;i<(x);i++){
#define rdln(a) a[i]=read();
#define rdln0(a,x) rrg(x) rdln(a) gr
#define rdln1(a,x) rg(x) rdln(a) gr

// #define int long long
const int mod=998244353;
#ifdef int 
#define inf 0x3f3f3f3f3f3f3f3fll
#else 
#define inf 0x3f3f3f3f
#endif
inline int min(int a,int b){return a>b?b:a;}
inline int max(int a,int b){return a<b?b:a;}
#define cmlSEGMIN
#define cmlSEGMAX
#define cmlSEGSUM
class SegTreeAl{
#ifdef cmlSEGMIN
	int minn[1000005<<2];
#endif
#ifdef cmlSEGMAX
	int maxn[1000005<<2];
#endif
#ifdef cmlSEGSUM
	int sum[1000005<<2];
#endif
	int tag[1000005<<2];
#ifdef cmlSEGSUM
	void pushdown(int o,int l,int r)
#else 
	void pushdown(int o)
#endif
	{
		int&t=tag[o];
#ifdef cmlSEGMIN
		minn[o<<1]+=t;
		minn[o<<1|1]+=t;
#endif
#ifdef cmlSEGMAX
		maxn[o<<1]+=t;
		maxn[o<<1|1]+=t;
#endif
#ifdef cmlSEGSUM
		int m=l+r>>1;
		sum[o<<1]+=t*(m-l+1);
		sum[o<<1|1]+=t*(r-m);
#endif
		tag[o<<1]+=t;
		tag[o<<1|1]+=t;
		t=0;
	}
	void add(int o,int l,int r,int L,int R,int v)
	{
		if(L<=l&&r<=R)
		{
#ifdef cmlSEGMAX
			maxn[o]+=v;
#endif
#ifdef cmlSEGMIN
			minn[o]+=v;
#endif
#ifdef cmlSEGSUM
			sum[o]+=v*(r-l+1);
#endif
			tag[o]+=v;
			return;
		}
		int m=l+r>>1;
#ifdef cmlSEGSUM
		pushdown(o,l,r);
#else
		pushdown(o);
#endif
		if(L<=m)add(o<<1,l,m,L,R,v);
		if(m<R)add(o<<1|1,m+1,r,L,R,v);
#ifdef cmlSEGMAX
		maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
		minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
		sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
	}
#ifdef cmlSEGMIN
	int qmin(int o,int l,int r,int L,int R)
	{
		if(L<=l&&r<=R)
		{
			return minn[o];
		}
		int m=l+r>>1,res=inf;
#ifdef cmlSEGSUM
		pushdown(o,l,r);
#else
		pushdown(o);
#endif
		if(L<=m)res=min(res,qmin(o<<1,l,m,L,R));
		if(m<R)res=min(res,qmin(o<<1|1,m+1,r,L,R));
#ifdef cmlSEGMAX
		maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
		minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
		sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
		return res;
	}
#endif

#ifdef cmlSEGMAX
	int qmax(int o,int l,int r,int L,int R)
	{
		if(L<=l&&r<=R)
		{
			return maxn[o];
		}
		int m=l+r>>1,res=-inf;
#ifdef cmlSEGSUM
		pushdown(o,l,r);
#else
		pushdown(o);
#endif
		if(L<=m)res=max(res,qmax(o<<1,l,m,L,R));
		if(m<R)res=max(res,qmax(o<<1|1,m+1,r,L,R));
#ifdef cmlSEGMAX
		maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
		minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
		sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
		return res;
	}
#endif

#ifdef cmlSEGSUM
	int qsum(int o,int l,int r,int L,int R)
	{
		if(L<=l&&r<=R)
		{
			return sum[o];
		}
		int m=l+r>>1,res=0;
#ifdef cmlSEGSUM
		pushdown(o,l,r);
#else
		pushdown(o);
#endif
		if(L<=m)res+=qsum(o<<1,l,m,L,R);
		if(m<R)res+=qsum(o<<1|1,m+1,r,L,R);
#ifdef cmlSEGMAX
		maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
		minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
		sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
		return res;
	}
#endif
};
#define newe(n) struct Edge{int v,w,nxt;}e[2*n+5];\
typedef int arr[n+5];\
arr h;\
int cnt=1;\
inline void addedge(int u,int v,int w){e[cnt]=(Edge){v,w,h[u]};h[u]=cnt++;}\
struct node{\
	int u,d;\
	bool operator<(const node&b)const{return d>b.d;}\
};\
void dij(int s,int *d,int N)\
{\
	memset(d,0x3f,sizeof(int)*(N+3));\
	d[s]=0;std::priority_queue<node>q;q.push((node){s,0});\
	while(!q.empty())\
	{\
		int u=q.top().u,D=q.top().d;q.pop();if(D!=d[u])continue;\
		for(int i=h[u];i;i=e[i].nxt){int v=e[i].v,w=e[i].w;\
		if(d[u]+w<d[v])d[v]=d[u]+w,q.push((node){v,d[v]});\
		}\
	}\
}
#define mgs int fa[1<<22],sz[1<<22];\
inline int f(int x){return x==fa[x]?x:fa[x]=f(fa[x]);}\
inline int uf(int x,int y)\
{\
    int fx=f(x),fy=f(y);\
    if(fx==fy)return 0;\
    if(sz[fx]>sz[fy])fx^=fy^=fx^=fy;\
    fa[fx]=fy,sz[fy]+=sz[fx];\
    return 1;\
}
inline int read()
{
    int num=0,f=1;char c=getchar();
    while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
    while(c>47&&c<58)num=num*10+(c^48),c=getchar();
    return num*f;
}
inline int re1d()
{
    char c=getchar();
    while(c<48||c>49)c=getchar();
    return c&1;
}
#ifdef cmlBIT
struct BIT{int a[1<<20|1],n;
void add(int x,int p){while(x<=n)a[x]+=p,x+=x&-x;}
int operator[](int x){int res=0;while(x)res+=a[x],x-=x&-x;return res;}
int operator()(int l,int r){return (*this)[r]-(*this)[l-1];}};
#endif
int rnv[1000005];
// #define COMB
#ifdef COMB
#ifndef int
#define int long long
#endif
int fac[1000005],inv[1000005];
#endif
void initprog()
{
#ifdef COMB
	fac[0]=inv[0]=inv[1]=1;
	rg(1000000)fac[i]=fac[i-1]*i%mod;gr
	rg(1000000)if(i>1)inv[i]=inv[mod%i]*(mod-mod/i)%mod;gr
	rg(1000000)rnv[i]=inv[i];gr
	rg(1000000)inv[i]=inv[i]*inv[i-1]%mod;gr
#endif
}
#ifdef COMB
int C(int n,int m)
{
	if(n==m||m==0)return 1;
	if(n<m)return 0;
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
#endif
inline int qp(int a,int b){int c=1;while(b){if(b&1)c=c*a%mod;a=a*a%mod;b>>=1;}return c;}
inline int mae(int &a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int mde(int &a,int b){a+=mod-b;if(a>=mod)a-=mod;return a;}
inline int mle(int &a,int b){a=a*b%mod;return a;}
inline int mve(int &a,int b){a=a*qp(b,mod-2)%mod;return a;}
inline int mxe(int &a,int b){return a=a>b?a:b;}
inline int mne(int &a,int b){return a=a<b?a:b;}
inline int ae(int a,int b){int c=a+b;return c>=mod?c-mod:c;}
inline int de(int a,int b){return ae(a,mod-b);}
inline int me(int a,int b){return a*b%mod;}
inline int mive(int &a,int b){a=a*rnv[b]%mod;return a;}
inline int ive(int a,int b){return a*rnv[b]%mod;}
inline int ve(int a,int b){return a*qp(b,mod-2)%mod;}
#ifdef cmlST
struct STmin{
	int a[21][1000005],n;
	void init(int N,int *b)
	{
		n=N;
		rg(n)a[0][i]=b[i];gr
		rg(20)rg_(j,n-(1<<i)+1)a[i][j]=min(a[i-1][j],a[i-1][j+(1<<i-1)]);gr gr
	}
	int q(int l,int r)
	{
		int d=std::__lg(r-l+1);
		return min(a[d][l],a[d][r-(1<<d)+1]);
	}
};
struct STmax{
	int a[21][1000005],n;
	void init(int N,int *b)
	{
		n=N;
		rg(n)a[0][i]=b[i];gr
		rg(20)rg_(j,n-(1<<i)+1)a[i][j]=max(a[i-1][j],a[i-1][j+(1<<i-1)]);gr gr
	}
	int q(int l,int r)
	{
		int d=std::__lg(r-l+1);
		return max(a[d][l],a[d][r-(1<<d)+1]);
	}
};
#endif
#ifdef cmlSAM
struct SAM{
	int ch[1000005][26],lnk[1000005],len[1000005],lst=1,cc=1;
	int sz[1000005];
	void insert(int c)
	{
		len[++cc]=len[lst]+1;sz[cc]=1;
		int p=lst;lst=cc;
		while(p&&ch[p][c]==0)ch[p][c]=cc,p=lnk[p];
		if(p==0)lnk[cc]=1;
		else
		{
			int x=ch[p][c];
			if(len[p]+1==len[x])lnk[cc]=x;
			else
			{
				int q=cc;++cc;
				lnk[cc]=lnk[x];
				lnk[x]=lnk[q]=cc;
				len[cc]=len[p]+1;
				memcpy(ch[cc],ch[x],sizeof(ch[cc]));
				while(p&&ch[p][c]==x)ch[p][c]=cc,p=lnk[p];
			}
		}
	}
	newe(1000005);
	long long ans;
	void build()
	{
		rg(cc)addedge(lnk[i],i,0);gr
	}
	void dfs(int u)
	{
		fe(u)dfs(v),sz[u]+=sz[v];gr
		if(sz[u]>1)ans=max(ans,1ll*sz[u]*len[u]);
	}
}t;
#endif
char aa[2000005],bb[2000005];
signed main()
{
	initprog();
	int T=read();rg(T)
	scanf("%s%s",aa+1,bb+1);int n=strlen(aa+1),m=strlen(bb+1);
	int a[27]={},b[27]={};
	rg(n)a[aa[i]-96]++;gr
	rg(m)b[bb[i]-96]++;gr
	int flg=1;
	rg(26)if(a[i]<b[i])flg=0;a[i]-=b[i];gr
	if(flg==0){puts("0");continue;}
	int res=0;
	for(int l=1;l<=m;l++)
	{
		int t=1e9;
		rg_(j,26)if(b[j]==0)continue;
		int need=(b[j]+l-1)/l;
		if(need*(l-1)>b[j])goto fk;
		t=min(t,a[j]/need);
		gr
		res=max(res,t);
		fk:;
	}
	oldl(res+1);
	gr
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 1564kb

input:

2
bajkaaall aal
abca cba

output:

2
1

result:

ok 2 number(s): "2 1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 1604kb

input:

16
a a
a b
b a
aa a
ab aa
ab b
ab c
aaz az
abcde edcba
aaaaaaaaaaaabbb aaaaaaaaabb
aaaaaazz az
aaaaaaaaaz zzzzz
gggggggggggggggggggge ggggeeee
hyphyphyphyphyphyphyphyphyphyphyphyp eeeeeeeeee
hyphyphyphyphyphyphyphyphyphyphyphype eeteeteeteet
aaaabbbbbbcccccccc aaabbbbbcccccc

output:

1
0
0
2
0
1
0
1
1
2
2
0
0
0
0
1

result:

ok 16 numbers

Test #3:

score: 0
Accepted
time: 33ms
memory: 1508kb

input:

90522
cyykzyylklyll ylcyllklzk
ttusuuudtdtqus uuddu
uefyqfkiblyfkyd ffyyqde
qfxqecljeqeedea jqdxf
prrbfxdxffpbpp ffppd
ynjgygygjnjnjg jgynjggn
maenpaksmxyya saxkep
nrdnbnjipnjowjz djbwojzrpni
oputuoufoojupu uoouopo
mphmhphpkpkpmhp phmhpppp
zwznzpzqyjczzy wczjnpzqy
pfxfxxkfffpfx fxffkffxpx
hzdhzhhh h...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
4
1
1
1
2
1
1
4
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
2
3
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
2
1
1
1
1
4
1
2
1
1
1
1
1
3
1
1
3
1
1
1
1
1
1
1
1
1
1
1
3
1
1
4
1
1
1
1
1
1
1
1
1
1
5
1
7
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
...

result:

ok 90522 numbers

Test #4:

score: 0
Accepted
time: 35ms
memory: 1584kb

input:

100000
qpohohoqoyqqtkqoqqqfl qptqyqq
yrirresrslrssrrryysrs srysssy
qqtqqslrrsrlfmqtssrhr rsfsq
jfejsqjyflsqqlyydqdts yqsjj
zrzrezrzzszzrrrrrrrrr rrrrrz
ifqgfqqfttbbhgoqqgiqq iqgbggq
xejojrxlglerjgjljppjv jjjje
whhtowwwwhrhhthttombt hoohh
tqwthgtnstqtwattstwww tsqwwqs
cwurupfwrkckupkckpkzu pkcp
ogonm...

output:

1
2
1
2
3
1
2
1
1
2
1
1
3
1
1
1
1
1
1
1
1
2
1
1
1
1
2
2
2
1
2
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
5
1
2
1
1
3
1
1
1
1
1
2
1
1
1
2
1
2
1
1
1
1
1
2
1
1
2
1
2
1
3
2
1
1
2
1
3
2
1
1
1
1
1
3
1
1
1
1
1
2
2
5
1
2
4
1
2
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
...

result:

ok 100000 numbers

Test #5:

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

input:

88214
lysxulsgzsxybcgbbcglx zyysssu
kdlrkfhkzkzqqdkqoqkfr loqkkqh
ceaiiaipiipzazizpaaiz ieaicai
jbjzowzcaioauqmbiuzjm wcq
kdnkdddddjcdmndkmjdkd dcdjnj
ywruruwpyuwpwwwzxuxwz xxrwwuu
fapaffifoafopyyaiaaaf ffffoyp
zzzvzaavazvazzzzvvzzv avvvavv
fbtubsuubsufstbdfefet bedue
bylyggblggvgbymybvlvg vmvg
aara...

output:

1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
3
2
2
1
1
1
1
1
2
6
2
1
1
1
1
1
1
1
1
1
1
1
2
6
2
1
1
1
2
1
1
1
3
1
1
1
1
1
1
2
1
2
1
2
1
1
1
4
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
4
1
1
1
2
1
1
2
1
1
1
1
1
1
2
1
1
1
2
1
1
1
2
1
1
2
1
2
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
2
1
7
1
1
2
2
1
1
1
1
1
2
3
5
2
1
1
3
3
1
1
2
1
...

result:

ok 88214 numbers

Test #6:

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

input:

95170
vlrsovvpollyrorrl lrrrly
btcbtenuvbsbapw bcbuse
hlxyhhhbhuxhybxh hlxhx
qgiccigisiiiirci qcc
jxpjjjhjojojhj jhjph
xxwwwewtweeed wt
yxxbqjzjnblzjmn znq
rbmbbbbbbmrblbmb mmlmb
rneccaccrtchnxorc athrrc
kkxkxxkxxkkxxxk xxkxkk
donsxndqd nn
csccvvscvvcvzc ccvs
bkhhkkhkh hhbhhk
mwvmvpmwjjpepvwer ejerj...

output:

1
1
1
1
1
1
1
1
1
5
1
2
1
1
1
2
1
3
2
1
2
1
1
1
1
1
1
4
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
4
1
1
1
2
1
4
4
1
1
1
2
1
1
1
1
1
9
2
2
3
1
1
3
2
1
1
1
1
3
1
1
3
1
2
1
2
1
1
2
1
2
2
1
2
1
1
1
1
1
1
2
3
1
2
1
1
1
1
1
2
2
1
4
1
1
1
1
2
1
1
5
2
1
1
3
1
1
3
1
1
2
2
1
1
1
2
4
1
...

result:

ok 95170 numbers

Test #7:

score: 0
Accepted
time: 30ms
memory: 1588kb

input:

96180
rqkdfgusdfgffjkru jkksq
ddeeeddeuude duue
vuyuluqyqjwyqqjwwj uylvq
srnlpkpoeggywrdpig ppgpg
stqxlqxqsqqlssq lxqlx
sbpsnnfbnppfnsjp nfjsb
bvqmbbgbzkgvkkgqmz qqb
kkkhhlhvhhjhhk hvjl
xxqyxeqfbssyeewex wsf
twmlbtitqltmik mm
ccbczbccbycbceb ccccb
msmjjmpifepj mjsjj
kbmkkbkbkmbkmmkk bbbb
fpgfrpbkrrh...

output:

1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
3
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
3
3
1
1
1
3
1
1
2
1
1
1
2
3
1
2
1
1
1
2
1
2
2
4
1
2
1
2
1
1
5
2
2
1
1
1
1
1
4
4
1
1
1
3
2
1
3
1
1
1
1
1
1
1
3
1
1
2
5
1
1
1
1
2
1
1
1
2
1
1
2
1
2
1
1
2
10
2
1
1
1
1
3
2
1
1
2
2
1
1
8
1
1
2
1
1
1...

result:

ok 96180 numbers

Test #8:

score: 0
Accepted
time: 24ms
memory: 1580kb

input:

84351
bkiiiekpipghhkhhpia abgh
vchhuubuhbnhzxdg huuh
yyeoyeereybieerry ryr
ttzwzwtzzzcwztww t
xoxokixkkkck xxoo
lcrzzlbcuzgggakldzg blll
lohwlllrolrlkllwln nlkh
zosszzookkongnkpnn nkgp
zzqqqqqzzqqqqrzrzqq zzq
pqupfefpqwezuzppbq q
kxoxhughuuuuugk huuu
gkbsnwnnnupsnsnrjzs nk
mbvmxttddwdvzv vxdm
xnptax...

output:

1
2
2
4
1
1
1
1
5
3
2
1
1
3
2
1
1
2
1
1
1
1
2
1
1
5
3
2
1
2
1
1
4
1
1
1
1
1
1
1
3
1
2
1
3
1
7
1
4
2
1
1
1
1
1
2
2
6
1
9
1
2
3
1
1
1
1
1
2
2
1
1
1
1
2
4
1
10
2
3
1
2
2
3
8
1
1
3
1
1
5
4
3
1
1
2
1
2
2
1
8
1
3
1
1
3
7
1
2
1
1
1
2
1
1
2
2
1
2
1
1
1
7
1
5
2
2
1
1
1
3
3
1
1
2
1
1
2
2
1
1
1
1
1
4
2
2
1
3
7...

result:

ok 84351 numbers

Test #9:

score: 0
Accepted
time: 28ms
memory: 1608kb

input:

99795
qimqpqdqnmmqprdfqpqqe imp
ttzswwzwzszjjzwjzzoowo wto
zzwwzzwwwqgppzpwpizq zwp
juaiaiiiiaaajijiiaqrti jra
ynydxdnyyxyyxxtdyyrby ydy
ggweegjowgspqvbpkwcw pbp
rgrrrreimvvggrardrr eri
gonotggooogovbnodocw nt
hmqkkqzmzrkzmmztk tzh
hqjghjhjjhdgdjhhhgnnh hj
szfjjqjbsbjjsjzjjss zsz
ntmeiimiimpibujiiix...

output:

1
2
4
1
3
1
1
1
1
5
1
3
1
1
1
2
2
7
3
1
1
2
1
4
2
1
9
1
2
5
2
4
1
6
1
2
7
7
4
2
4
4
6
5
2
1
1
1
3
4
2
2
1
1
2
1
3
1
1
1
1
3
1
21
1
1
1
1
2
4
1
3
1
2
2
1
3
1
2
1
2
2
4
4
8
4
1
2
2
1
3
10
3
3
7
1
1
3
1
2
1
2
1
1
1
1
1
5
2
1
2
2
3
3
5
1
2
1
1
1
1
1
1
2
4
2
5
2
1
1
2
1
4
11
1
1
4
2
2
9
7
2
1
1
1
1
2
3
1...

result:

ok 99795 numbers

Test #10:

score: 0
Accepted
time: 22ms
memory: 1596kb

input:

97112
nnnhnoogzhzho zgonzngnonn
znzyzanuaaaaa aznanaazyzzna
wrwwtvwwwwww rwtv
xjfdojyjvvaaa dvvxfovvjy
ymqyyymiiyyyy mmqyyyqq
qbbppuqqccpbq qcbuccqpcu
trrsttrstsv vvsrrs
yedyedyyddedx yxxddyyxxyx
alvxdgdguydal uxyddv
gfgggxgigi ggggggi
yffjyfjfijyf jijiiiiif
ctccttce ee
qqxqdxdedquud qeedeeeee
gzgqy...

output:

0
0
1
0
0
0
0
0
1
1
0
0
0
1
0
0
0
1
1
4
0
0
7
0
0
0
1
0
0
0
0
1
0
0
1
0
2
0
1
4
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
1
0
3
0
0
1
0
1
0
0
0
0
1
0
3
0
0
0
0
1
1
1
0
3
0
0
1
0
0
1
0
0
0
0
0
2
0
0
0
0
0
0
5
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
...

result:

ok 97112 numbers

Test #11:

score: 0
Accepted
time: 35ms
memory: 1588kb

input:

83674
ssspsssspssssspsssssspsssssssssssspsssssssss sspssssspss
gggiigggiiiigggggiiigiigggggiiiigii gggigggiggg
djjjjjjjjdjdjjdjjddjjjjjjjjjjdjjjdjjjjdj ddjdd
ttttttttttttttttttttttttttttttttttttttttttttttttttd dddddddddd
aaaaaaaaaaaaaawaaaaaaaaaaaaaawaaaaaaaaawaaaaaaa wwwwwawwwww
ppeppeppepppeeppepp...

output:

4
4
3
0
0
4
10
0
0
6
5
1
1
9
0
12
8
4
16
0
0
21
7
3
2
5
0
7
8
13
37
9
6
3
0
0
0
1
14
4
0
2
5
1
0
0
5
9
38
4
0
0
0
0
0
3
4
5
1
0
4
3
2
32
0
2
7
5
0
1
0
8
1
0
0
14
28
0
0
0
14
7
7
0
2
14
0
0
1
1
7
0
5
7
0
1
3
10
4
0
2
0
6
1
1
4
1
7
2
1
0
0
1
8
3
11
3
10
2
10
5
42
1
0
2
14
4
0
6
3
2
1
5
1
1
3
3
0
10
7
...

result:

ok 83674 numbers

Test #12:

score: 0
Accepted
time: 34ms
memory: 1516kb

input:

62490
zzzzzzezzzzezezzzzzzzzezzzzzezzzzzzzzzzzzeezzzezzz zzzzzzzz
hhhhhhhhhhhhhvhhhhvhhhhhhhhhhhhhhhhhvhhhhhvhvhhhhhvhhhhh hvhhhhhvhhvhhhh
qqqqqqqqqqqqqffqqqqfqqqqqqqqqqfqqqfqqqqqqqfqfffqfqfqqqqfq fffffffffqfqffq
aaaaaaaaxaaaxaxxxaxaaxaxxxaxaaaxaxaaxaaaxaaaaaaxaaaax aaxxxxxxaxxxxaxx
wwwjwwwwwwwwwwww...

output:

35
4
1
2
41
7
30
35
17
1
1
9
21
8
40
6
5
26
8
2
3
16
25
9
10
28
5
10
9
27
19
20
1
10
43
3
20
25
4
3
34
20
16
1
7
4
12
5
2
8
1
2
2
7
4
3
20
12
3
22
5
5
2
20
7
5
18
8
13
8
9
20
11
4
1
21
16
46
47
8
8
10
11
3
3
5
8
9
10
8
11
15
8
7
3
36
17
6
10
8
13
11
34
5
11
9
10
10
1
2
10
18
11
2
8
13
9
12
24
19
13
...

result:

ok 62490 numbers

Test #13:

score: 0
Accepted
time: 15ms
memory: 1568kb

input:

16387
mmmmmmmmuummmmmmmummmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmummmmmmummmummmmmmmmmummummmmmmmmummmmmummmmmummmummummummmummmmmuumumummummmmmummmummmmmmmmmummmmmmmmmmmumuuumummmmmmmmmmmmmmmmmumumummmmmmmummmmmmmmmmmummmummmmmmmmmmmmmmummmmmmumu ummuuuuuuum
thhhhhthhhtthhthhhhthhhhthhthhhttthhhhthhhhhhthh...

output:

15
52
37
60
11
109
64
25
21
14
59
36
73
65
8
47
27
10
50
36
25
38
9
56
62
43
30
31
35
139
58
17
28
59
92
9
62
15
82
71
97
94
16
23
1
8
61
159
38
8
103
88
32
18
18
18
55
24
43
4
35
17
30
36
35
138
7
12
17
41
99
13
59
2
67
139
3
201
22
34
41
81
109
13
15
28
42
12
28
42
10
31
53
91
45
23
32
36
31
36
32...

result:

ok 16387 numbers

Test #14:

score: 0
Accepted
time: 38ms
memory: 1584kb

input:

95000
ffctccfffcfft cffftft
nnuuuunuunnuuuuaunuuuuuuuuuu nununnuu
aaaaaaiiaiaaaaaaiaaaaaaaiaaagaiaa aia
sggsggsgssyssgsgsyggysgggss ygsygg
kkkkkkxrxkkkkkkkkkkkkkkkkxkkkkkrk krxxkkkrk
ykhhhyhhyhhhhkyyyhhykhhyyhhky khhyy
fffnnnfffkfnknknf nffffnkn
glllllllllllllllllllelllllllelllll ee
eieieieeeeeeiiee...

output:

1
3
6
2
1
4
2
1
1
1
4
1
1
1
3
1
1
12
10
2
1
3
4
1
1
1
3
1
2
1
1
1
1
9
13
3
1
2
1
3
1
1
1
2
3
3
9
3
1
23
2
1
2
1
4
12
1
6
1
2
9
1
3
7
1
2
1
3
1
2
8
1
2
13
2
6
1
1
2
2
1
2
1
1
1
6
2
1
5
1
7
5
7
12
17
2
1
2
1
14
7
3
8
3
1
1
5
1
2
2
1
1
5
1
3
4
1
11
5
1
1
4
7
16
1
1
1
1
2
5
1
3
2
2
1
9
1
1
6
5
1
1
3
1
7...

result:

ok 95000 numbers

Test #15:

score: 0
Accepted
time: 38ms
memory: 1580kb

input:

92634
qhchcqchhchqhqhhchhhhqqhhhq qqqqqqq
mmlppmplpmmpllllmmpp lllll
qqngnqgnngqqgnqqqgnnqqnqn qqnqnnnqq
tjtjjggttjtjjttjjjjjggtjg ggtjjj
ollllloolllllollloolollololllloll lloollloo
fxffxfflflfxfflxlffxxlx xlxxxxxxf
rrnnrrrruunuurrnurnunrrnrnrrrn nnrrnrnn
usssussuuuussussssusuusuuuus usuusususs
qccq...

output:

1
2
6
4
7
1
3
10
1
3
1
6
6
2
4
18
10
3
4
2
2
6
1
4
1
4
1
2
4
1
1
5
1
1
3
5
1
5
2
2
1
3
4
3
5
1
4
2
32
8
3
6
2
4
8
1
1
1
3
2
1
1
4
2
1
1
2
1
3
6
13
1
2
3
3
1
2
5
5
1
1
8
4
11
1
2
6
3
4
1
5
6
1
15
4
5
7
3
6
4
3
2
3
3
1
1
1
1
2
7
4
1
2
1
3
4
6
2
5
1
4
1
8
1
2
1
2
4
13
5
1
4
22
1
2
12
2
2
3
2
1
1
3
2
4
...

result:

ok 92634 numbers

Test #16:

score: 0
Accepted
time: 35ms
memory: 1616kb

input:

92852
xxxxxxxvxvvxxxxxvvxxexxxxxvvxxxxexxvx xxxxxxxxxvv
rhhllrhlhhhhhrhrlrrhhrrhhhllrhhhll hhrhlhhhhhh
hplphppphhphphpphhpphhhhhhhhphhpp phhhphhphph
jjjjjjjjjsjjjjsjysjsjj sjsssjsjjss
bbbgbxxggxgbgxbbgggxxgg xxbxxbxxxxb
svsvvvvvvsgvvvvsvvvvsvsvsvvsvsv gsggggggggg
gggklkkggkgllglgklkkkkglkgklkkkgkgg ...

output:

7
2
6
0
0
0
3
1
0
1
0
0
0
2
0
2
0
0
0
0
0
0
4
2
1
2
2
0
3
3
2
0
0
2
7
0
0
0
0
6
3
0
0
0
0
0
2
0
5
1
0
0
0
2
0
0
3
0
0
4
0
3
1
1
1
1
0
0
1
1
2
1
0
1
6
0
1
4
3
1
0
1
1
0
3
0
0
4
1
3
1
0
0
0
1
2
1
1
0
1
6
0
2
1
4
2
0
0
2
0
0
1
0
2
0
3
1
0
2
0
0
0
0
7
2
3
1
1
1
1
3
2
0
0
3
1
0
0
5
2
3
1
0
1
2
0
0
0
0
2
...

result:

ok 92852 numbers

Test #17:

score: 0
Accepted
time: 25ms
memory: 1616kb

input:

18912
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...

output:

77
67
17
266
114
216
247
57
82
264
103
247
276
36
93
244
100
243
30
139
244
282
68
14
101
256
12
65
5
216
152
234
182
5
271
197
327
200
65
45
166
271
141
167
169
208
70
135
139
143
15
99
194
146
12
75
169
282
179
255
47
39
254
161
246
22
34
59
37
178
140
122
324
65
46
138
65
220
51
119
258
272
26
19...

result:

ok 18912 numbers

Test #18:

score: 0
Accepted
time: 47ms
memory: 1620kb

input:

93950
jtjatjtjtatjjjajatjtj jatattjjjtaajttjj
xxxxgcxgxggxggccx xxccxxcxgxx
nttptptnpptnnppnnpnnptpntt nnpppnnnppnpnnn
kyhhkkkkhkyhkykyhhkkkykyhky kkkkkkkhyykkhhky
nmmmmmnmnnmmmmmmmmmmmmm mmmmmmnmmnmmmm
vvcvkvkkckkvcvvccvvvcv ckvvkckkccc
jffjnjfjfnjjnjnnfjjnjjjf jjjjnnjjnjnjnj
dtdwdtttdtdtdtdttddd d...

output:

1
1
1
2
2
1
2
1
1
1
1
3
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
3
1
1
1
1
1
1
2
2
1
1
1
1
2
1
5
1
1
3
2
1
1
1
1
2
3
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
2
2
1
1
3
1
2
1
1
3
2
1
1
2
1
1
1
1
2
1
1
1
1
1
2
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
2
1
1
1
1
...

result:

ok 93950 numbers

Test #19:

score: 0
Accepted
time: 46ms
memory: 1504kb

input:

97146
rrvrqqrrvqrveervrvrevr qeevvvvrvqqv
ffqpqpfppfqpppfpkppp kppppppqpppppf
iifmfmmfnmffmfffmffnmf minmmfmfmmf
beenaeeeebeeeeeeneeae ebeeeaeeeeebaeee
eeseskksekskksksesesks sseekkeksskssssk
kkkmmkekevveevvvkvvkvk kkkvkkevkkvvkv
nnnnnnhhnjhfjnnnnhhnhn nnnnnnnnnnjjnnh
vnaqaaaaannnnvanvaqan aavaavava...

output:

1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
7
1
2
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
3
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
5
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 97146 numbers

Test #20:

score: 0
Accepted
time: 15ms
memory: 5476kb

input:

1
bsjgcfpiktklxlxlfqkwqluatehtlphewnurduntychudptiocmecijoirykdomylbxakttepugeilrftyfhiljfbnasluzwoyntlhaerrlkhhhayzswixqqtvxhusqdxeyujaqcgfqjcjttuppajzatxskluixtmbyuiosymyquelrzpnyspcqpuejmwtqwfdszucwpvlenvjqmzmeaebmzgdqxybmzazfkrtopyxfosjwaonzsofecfcimnrijfxxaeathrxsoauyqcbiqafmhkqrnrjtxblbliwhwvq...

output:

1

result:

ok 1 number(s): "1"

Test #21:

score: 0
Accepted
time: 36ms
memory: 5488kb

input:

1
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

1

result:

ok 1 number(s): "1"

Test #22:

score: 0
Accepted
time: 6ms
memory: 4552kb

input:

1
hxxfiwatcuhxnyklydflhvnzxwdgdypkkkqlzkjjzvcgvpeiqftqyvyhqjgkpvpujbbqnoupkpabfmsmfmmpdfsdzomlvpiejqgespwsromrzderhwtblwslycqoqgkovcwikwqgginfvqpbxradluhmfypvmzirbfwttpadqdbvwvvkbnbdahzjhyiwwklcqekppvlhwfpxpokvmubmknvcwsqektnqvguqzzteccsevyauowmmlkcvgjycbwadhqfuhtcywrpshlvemaeerjftbnsodudxsvbljyxnuo...

output:

201

result:

ok 1 number(s): "201"

Test #23:

score: 0
Accepted
time: 12ms
memory: 4916kb

input:

1
csozmbzomyyzdvvmfiwqjzxuixtniespsnmybsvsxqfcscwmxskcozwwzuwczyzsuwxismszismswsveqczcsozsnvnzqpszzszmyvemwmfwqmksuzxestsusfuumsmmnmsyccusinzfbwsysvzcmnzcmrmxgibzxiewsmnzmwsmewsejswzqzuekrvuzmcwsouesstguysuukuwwuviywxmtmlsnuswimmwknygcsxzymcsszsufefzzwgiwusguxzzswxcsciznzsiomxzwzokmmusosczxoccuniimf...

output:

35

result:

ok 1 number(s): "35"

Test #24:

score: 0
Accepted
time: 3ms
memory: 3916kb

input:

1
wmikwxmwsoasiqxigsgusfhszunrxmkwlcdgdxzwcgbnlllasgwsedwxkztlowfztntlvgfdjvzdjwxphvgdblskunnkqlmujzlilqiltxcyybxdfciziyfbpgiksqrneimykxncljjhkweuqznfrkyrltffggbmxbdhqkxndnizqfycugfoskgbayznludvdatzsdltxayqimlowcfqzelskademprtljdfdjcdyurmvltzvpkxuzddlcnjbsptdnzleasijkqqrrjgtyntwunzdiaiigwcqswhalqxdd...

output:

15

result:

ok 1 number(s): "15"

Test #25:

score: 0
Accepted
time: 5ms
memory: 4300kb

input:

1
ppppphpnrphpnpmppmpppnppdmmmpppppnmmpprmdmpppmnnpmfmwmpppdrphprhwmppmppppnmnmmpppmpnppnpppdwmkppptppnmmmppnmppppppnmppodnpnmppmpmmmpnpmmpvpmnpmpnpmpppppnmmwvnnmpdmppppmmnpvppndpmhpknhndnpdptpndnppppvphmpproppmhppppmpppnkprdpnnpmhpppdmrpmpmnpppppmppopptnpppppnnmponppppppdphvnpppmnprpmmpmdptpprnpmpm...

output:

1

result:

ok 1 number(s): "1"

Test #26:

score: 0
Accepted
time: 5ms
memory: 4172kb

input:

1
nwdvjpruhrgysbxjkjhdehebtuwjyksphydmzcfzvckugojwgklceyifgevybwnsunbakiwqxieztmtoatjkjvxniqfhpogytgmlejvhpuydtabpsmtdxaesquhwxuiwjceuzwmwilqfsokjoobbegrpojssaqeojdejjgdjwurortoiqqrscwfaqjotzcchiisjnqcphjppttivlidpfmpulwsvcxrdjgzhuqxjncjlharowhxqnmqopqzldpgicamlgqjdxutxkuavaqhxksfxicmvdnpillucyeptoy...

output:

319

result:

ok 1 number(s): "319"

Test #27:

score: 0
Accepted
time: 14ms
memory: 5416kb

input:

1
dlenbdsjmzzslmaqpqkggzpjuxkkltswnzgaaixgfiriuukfblqnmhqdiviugzdiryxplyfitzjbavhpsemhpdpgnpetfyldtlmgpgzdwdothoczjnksqjtedtvxndvfdttkefptrychboyzvczxdneueaipmnpqbwmxcgowkkdhykxlsqrczruqdvmfhdmvvsssymyyuuwlsjmkgrbnvikrosflptsnyadlkcczhxydrdtdxyytyqzpgojjprcrhuysiwailzagjxztaxqpgjxkidyngwdcpouhezjbvv...

output:

12

result:

ok 1 number(s): "12"

Test #28:

score: 0
Accepted
time: 11ms
memory: 5332kb

input:

1
stmzbeafwzvavtvumqopjdsewpsqdvhcokdjevlzklvqxljzslxqoxxhsqvdiplhjkzklpaguytuiqastdmxojppzuunsyvzvvyfxckhvkwzewhsrnbuoflagyjbnnqqqabpcecgnaydauunmaxpkchaeqsuxhyiztdyxcljyujxhdkobdgibvlnqcmkyzuujovxqphiguggnvxhmrldcbnvdnxkjxdnimnptmirqipajvvxxymaosvnczfohuglbzqnlufgwrifyebczlgvemypbucibeovuyqxwxonmm...

output:

0

result:

ok 1 number(s): "0"

Test #29:

score: 0
Accepted
time: 12ms
memory: 1564kb

input:

2000
ewpuhshjepfwsvxorkneeollbfrvwlgedfamwnqqhizlqjjsotjeoljcykllyhkjugogjgqqqbteisersjwgkwrewsmsubinkydvwgbrgaunjbxiwtofmknolgbkxzianfpczceayrlyyonnowhqdgvswslkqqwoyvhtfyblvchyyfttfbuodzkqquluwgwkhvrgjdrzcllsqjceohvdonhojkmiwnqogyznjqlxuvohwxindtwsiaeovyadukmyzvpohdsbdllzmchiyapsztbhhaazccapyxtnffo...

output:

0
1
1
0
1
0
1
1
0
1
1
0
1
1
0
1
2
1
1
1
1
1
0
2
0
1
1
1
1
1
1
2
1
1
0
1
1
1
1
1
1
1
1
1
2
1
1
0
1
1
0
1
1
1
1
1
1
1
1
0
0
1
2
0
1
0
1
1
1
1
2
0
1
1
1
1
1
2
1
0
1
2
0
0
2
0
1
2
0
2
1
2
1
1
1
1
0
1
2
1
1
1
0
2
0
1
2
2
0
0
0
1
1
2
1
0
1
1
1
2
1
1
2
1
1
2
1
1
0
0
0
2
1
1
1
1
1
1
1
2
2
1
1
0
0
0
0
1
0
0
...

result:

ok 2000 numbers

Test #30:

score: 0
Accepted
time: 3ms
memory: 1536kb

input:

200
ckkuibmjprqcvjyzogypzerpgrnvfonhknyuwqfsqrkobscjugblsrinyabdvtlufcexservhwwvwhimcouaydmvytgliaesgrcxptnthengufeagnfpagjjzvesckpzhjwdfgvoswfgadnhkybsbljmjbivvwofmqqpriucmtqtvxhdeczqoikxpkqzdnqogjgnglodixwoctddkhqjvbivarebfzeiewwliwynpyvkdkexjoiboojfdbuvvtlcererhexlycnurgzsrllbopnnqsgkggflxqrggzjg...

output:

16
17
15
15
16
17
15
15
19
17
15
15
17
15
15
18
17
15
15
16
15
14
18
13
16
16
17
18
18
16
15
16
15
17
14
15
15
13
15
15
16
14
13
17
14
14
17
16
17
17
16
15
15
18
16
17
15
16
16
15
17
16
14
16
15
17
15
14
15
13
17
17
17
15
15
15
15
13
17
15
16
17
18
18
15
17
16
13
15
16
16
17
17
19
16
14
16
14
13
17
...

result:

ok 200 numbers

Test #31:

score: 0
Accepted
time: 12ms
memory: 1740kb

input:

25
sjegbncuyvchkqxmzmgioxvuebhxdnkhroreaiajrrlhfguyqoomlrjmpadcwuefyymnlutdxpuliujluooewjwyzjeaggkhsetzyojpzleyijuxtogjmqpjjpupxlthzutbtcbsvotxlmwpvnylovhbaolcjefplxbjwtrxgpdluljdzixibgteehyouaqvsvakxacbttplvozkbepzwujulfjvqdetdrzeqvsmmfhlhvvnecpozxckvhchgyharhmfhjpflylszhjrdemoaeuqzdadmrdtxkkzlxmci...

output:

29
30
29
32
26
28
30
31
29
29
29
30
31
30
27
30
27
29
29
29
30
29
27
30
29

result:

ok 25 numbers

Test #32:

score: 0
Accepted
time: 12ms
memory: 1824kb

input:

16
lsqppylqlmqvqyyosolboyqlfqlvsqhqucvqqoqcsyxzzczdayyayzqzusovyoxooqgoyzhnyqlywvdhylyonqufzashooqofqfydpzbhoyvsvfquyrswmfqqsxyoyxsqtozphlofbbfswbjhsalqysqsqeqyeolvdhzqaataybaxqhshvvlqqcbovsavhdqhlyvlklsacqaomvsbnhpqpnoaqoyayovvthqbwwcqnfmobayycbqybfsfsoaqqchqqzsvsoqcyqvoavoaosvboqyzstzlqxvqwbbyyvlv...

output:

11
12
5
9
8
9
13
9
6
12
9
4
9
7
10
11

result:

ok 16 numbers

Test #33:

score: 0
Accepted
time: 10ms
memory: 4492kb

input:

1
poojkzobzozbbkpkhjkebwkbbwwbzuuzoobubnoikbkuzokzbuwunbkbgubjjuwwwkwbbbkbezbuzguwozokzubkobbbwwwwbgkkwcbufzbjowjkzwkkbupjepubbzkwiwoobokpokjekwkkbnmobzuwuzugzebkkguojbbbuupwuekwwuxpzwknohuxzkpwokzbzijokuwkzobwwzbwokfobpifpbwwfukkzbuoobngwfunxkwnozkowwozzonhoukipjzfowuwpubkjzkjzznfaiwkuehbbujwhpzpwz...

output:

9

result:

ok 1 number(s): "9"

Test #34:

score: 0
Accepted
time: 10ms
memory: 4416kb

input:

1
bxcxmgmcycxxcggxczhxbmzhcgcxczzmzjmcxoccbhmgbhcxbcfbmcrmcroazzjmzjgxcmxfcgbfbfxmzzaomvobjxcamzxbbobhmamgxbvzmmbbjgfbzxxgcazgrccbgcgrzmfzzzrmzbhbomghcxbmbgzghgmbhjzxmbbjndgbvzzbfxbxzbmzmcmmzrbcrmbhjcbrhbcrxmmmzbrzmxmhxbggzmmmhhvhzcbbrbcggzzizbobzzffjcrxbggighhfcgrkbibmbhgmgfrhzhrczbhxmhbcofmmamfmmr...

output:

38

result:

ok 1 number(s): "38"

Test #35:

score: 0
Accepted
time: 11ms
memory: 4676kb

input:

1
dlmxdlwlvxwonlhkyawvmpxvxamhqmvxxvpulnqtapkfuqcxlwsuulmtxxnplqkfxkuxvftmuxtmnmwmlmmvolwmpnxplmoqqpgzgvmwvlmamkxvxpftutwvpwnnxxotxqvptgxltmlmuxhqkpwvggxmqltvvvuxfqxvvlpnmumlmmeumvxxwexnlllufpxllowulcxqukxwpxlnuawllxfttumxzmvxvqamxlvdqntlyvktowlpvllpnwmqxlwyuwlqukfwuxpxkxnmvvwvmxptwsxnpkxexqtyfxaxnw...

output:

76

result:

ok 1 number(s): "76"

Test #36:

score: 0
Accepted
time: 12ms
memory: 4812kb

input:

1
bfzbwjiqajspnjjiwpbpspsjpbhjbsswjwuwjkujpjjbfogsbjbjcejpwjsuaspjsbfwjwbsjpsbjnossijjcjnjbmbsjetkapajjbshjwiwblbnbajjfulkccuqqacbcjccpjjbjqnwvvpbbkuiinewzjwfijpjjqnpjnbnfnnnbvpbjpujosbbqsjpbcsbwbcjwbbmnpihushjumspjspjsuwhbjbqijvcbwcplwpjqnljsjpqhpbbpwputqjkjujsccvsbbwhjjbwbbbbjpjzbjjbpjnjhnshowpbwp...

output:

172

result:

ok 1 number(s): "172"

Test #37:

score: 0
Accepted
time: 12ms
memory: 4892kb

input:

1
yfeybtbbviubfybjkfcffibbulrblxvfbezfbufyejiumufbfzlkabfufrfxflafhfiuiydtzuhliflrflflzyabfafbaffbujvfuyazahukhvbnsubzcmfbbfauyyuummbfapacfffiufmfcfbfrkuzmuugrmgbuvducccuzyfhcbbbfuuuiaylzrzffhcfffrsfuuuuuauzubyawfvlfaxygfcbuulvabcazvxvuuubuyufffudaffdadbbffafruvbufauvuffabhawlulaydwbuzzufyuwpbcfcflf...

output:

393

result:

ok 1 number(s): "393"

Test #38:

score: 0
Accepted
time: 8ms
memory: 4704kb

input:

1
hpbcfnfivpmpdhppaxpdaipzfvzbfufvyypfzuhxdvfpdfvfpfvcvfpgfkeigpcoxfxdfpffglazpjygujrjwzpifraspgvhfjxhpunpvxmvvetaqppbvalijtkpupzhvnzrjzcfdasgpffubhidncfvzvpfyjdhagptopfpidjvknppxhyffzvpfufdzfyhfhppdefxuhofwfxfvbosftzfdafpnvvikbfvfqrffgyfiappahffvhrfannxztrvfppnjbfgvfgfplvvpejdpyfqcbqgwaacfzzihvhwhe...

output:

1814

result:

ok 1 number(s): "1814"

Test #39:

score: 0
Accepted
time: 8ms
memory: 4924kb

input:

1
ycxjnjztpcvgehtcwzbccwqcwrcfvxtyotppqxkqowcucbwwrfqacjvcjbicdcrbrjviitqbotcuihzplbutvmcctctwlccjgqbpuyhprcscrwxzhkcwnwiaqqbprdmcckrccitpsapcymrcrydkrtixummqcitceqyicsrcuyrphftcisctblzdlbrtrytlcxtpccicjqimttcdqiptqcpebhmteebcipecrcalutsuigycsgszyotvtcazjszmmincycgtqcynceiccqtqcectqpczsjcchxzjtsaqro...

output:

3303

result:

ok 1 number(s): "3303"

Test #40:

score: 0
Accepted
time: 11ms
memory: 4576kb

input:

1
yyyxatwkwppwkylwtwgwqfufixqvgptqhteqbybpquwncakktgklppbdhvhkvgtgktbhpjdqyzixgwmfqqypqigooxpeojgtzdtbocfpdblguaxtpnwxkawsyfgplpkrygyszhwgsxjuniuufbssyyiqwocgtpefvgtkbpojttjxthiqwydfqpkxnrlacwoyqrqsvtpwyrfpbbjqszpwtxgfydoaajuytpzdauwysytttgocvtjgnysbxcbgtwwcyvyqwrxllwwzbtqbzdbjqwtcqlgbyykjgbwrqfngik...

output:

21979

result:

ok 1 number(s): "21979"

Test #41:

score: 0
Accepted
time: 7ms
memory: 4656kb

input:

1
fvolrrxzflnjzlrrepwpppxuwniefmmlvtfrfjfnogxybnpucutpzpfrrxxfsnppxfhspqpjoxruygszwzddarmuewcwuaddgolwsggsagufwpbrffemwrzctryklxrdkmfsxfzfopxteepsnzzpmjpwwmppmpjajnfggbpxxxrrfpdbsmxqyxlrrfxzecsshfbpfnutxmtgwxpnxgoamnqpwtybigrhxyoxnazdrxsskpdppewcgrzrsmrjwdunjmtgxppxpdjcvtrrnpnjbfdfxgzvtdiirvgplxrqkp...

output:

19814

result:

ok 1 number(s): "19814"

Test #42:

score: 0
Accepted
time: 14ms
memory: 4920kb

input:

1
qqqdddddqwdddddjdddjqdqwddqddjdjjdwqddddddddjdqjjdwqddqqjdqdddqwjwwdjwddqdwwdqqdwjddjdddqjddwddqwwjqdwwqqdqjqjqwjjdqjwqwddjdjjddjjwjwdqdwjddjwdqddwjjdqdddqdjjdjddwwjdwdjqjjddqdqdqwjddddjqddqqddjqwddqwdddqqqwdddqwwdwqjdddddqqdjwdqdwdddwqdqwjqqdwwqdqdddwdwwddqqdjdwdjdddwjwdqwqdwdwdddwqwwwqdddwjdddjd...

output:

55556

result:

ok 1 number(s): "55556"

Test #43:

score: 0
Accepted
time: 22ms
memory: 5044kb

input:

1
pmpmppppmpmppmpppppppmppmppmpmppmmmmpmmpmpmpmmppmmpppppppmmppmpppmmmpmppppppppppmpmpmmmpmpmpmppppmmpmppmmmppppppppppmpppmmpppppmpmppmpmpppppmmpppmmpmmppmmmmppmppmpppmpmpmmmmpppppppppppmpmpmpppmppppmmpppppppmpppppppppppppmpmpppmpppppppmmmppppmpppmppppmppmmpppppmppppmpmppppmpppmpppmmpppppppmpmpmmpmm...

output:

154322

result:

ok 1 number(s): "154322"

Test #44:

score: 0
Accepted
time: 7ms
memory: 4392kb

input:

1
qididdjqfjfjifufujiqiujquiujufuqjuiidiufudqjiiiiujquiiiqijquuquufiiiufqujiqquuufuiquiiiuujfuuuiuufiiuiuduqjiiuffjqfjiffiuuidfqjuiufuijiuufqqjujjififqddufidiqiqfidffduifidiqjufudjffifuifiquiuifiuuuiiufuuufjdududiifjffjuuiuufuiuuqiiuijuuuiiuiiduuuuiqjiiififijjjijiuuiuiqufuqduqufjqufiijiifffujiidjjjq...

output:

6794

result:

ok 1 number(s): "6794"

Test #45:

score: 0
Accepted
time: 7ms
memory: 4624kb

input:

1
vqvdvqvdqqbffcqcvvbqvqbqbcvqqvqfvfqdcqdqvqqqqqvvqbccbbqqqbbbvbbbqqcdccvccvqcvqvdbvvdbfqqbbcvqqvfdqbbvvqbcbvvvdvfvdbqfqvcvccdqbfbfvvbvcqvbddbcvfqfbbfvbbbbdbqcbvbvbvvdqbcvvvvbvcvfbfvbccqqbqvvdvvbvbqdvvcfqcdccqcvdqqbvvbfbqvbddvbvbvcbvvqvqvqqcvcqbbvcfddqcffqbbqfbqvvvdcvfqfdqdvqbbqbbbdbfvfbqvvqqqbbqvcv...

output:

3290

result:

ok 1 number(s): "3290"

Test #46:

score: 0
Accepted
time: 12ms
memory: 4544kb

input:

1
bkqkvvkvkbvbqkqbqkqkqvqqqvvbbqkkqbqkqkbkvqkvqkqqqqqbbvqvkqqkkqvbkqqqkqkbbkkqqqkqqvkkkqqkkqqkqqkbqqqkkqvbqvkqqqkkbvvkkkvvqqvkqbqqvkqkkqkqkvqvqbvkbkbbbkbqvqqqkvbvqqkbvvqkbkbvqqqqkvvvvqqqqvqqqqvkqkqkqqvqvqqqqkqvbkqvqkqqkvqbqvkqbvvvkkbkkqbqqkqqbqqqqkqqqbkqqkqqqbvbbqqvqqqbqbqkbbvkqqkqqkqbqqbqqqvkqqkkkq...

output:

822

result:

ok 1 number(s): "822"

Test #47:

score: 0
Accepted
time: 11ms
memory: 4444kb

input:

1
vvvwwoovwtttviwovxvwtxtvvvvowooxoovxttvwtotwxvwxvvvtvvxvvvtxwvxxowxvtxooottwvwvrtptxwvwovxvtvvdxxwxwvtxxvvxetvvtopvtttxttiovtwtttwwvtxttdvvvtwtwoxvxvxtvtvxwvxetxuotvwtwtvtwxvttxwvvtwvwwxvxtrwttwtxxwvxxwxtwxxxroxevtvvttwxttvxxpvxxwtvtwxxxvxvwmowlwtvxotvwxootvvovxwtvmvvvvtwvxxvxvtovxxvvvtxwvxtxvtvvt...

output:

290

result:

ok 1 number(s): "290"

Test #48:

score: 0
Accepted
time: 7ms
memory: 4496kb

input:

1
qqazgakaabqavzazkzabkazkaakqaapqqqgagsgzgkkzqapakvkvaqaaqapvaakzzzqokgbzqkbzmkqzqkakaqpaaqaozvagqbzadakgagabzbbiqgamgazzbkzqizaakaanqzzgfagkzaqqqqkkgkagaqzagkakbqpkbvcaakbbmzkiakkkzgqzggaqqqogkaaaazgkakaqzzgbapkbzankavagakqggaaamvkqavvqabvuaazpqvmazavqzagqakzkamqkabagekzakqzvazvbazkkaaabuzzovazqkz...

output:

152

result:

ok 1 number(s): "152"

Test #49:

score: 0
Accepted
time: 12ms
memory: 4820kb

input:

1
qgtiwfcblywkcuqhklnjbqiqtbyuoolllqlldrbaxzxesnxeegnisnlivvghngipslvobwhxxzxppujsbxvhaxbzfbdyjpnvwcuecxedeeknfhikxupbinghdigbvzrufupopnjvpqkgzopnnxseoydlphplldzpqekqfktecdfdcxerhlqvlljvdpxnuzpxhwsavgentcljpqhjrpygjqeqqekegoueprwfrjrxvgvyxdkzyzzatdcntrlurfrawcxcobfoygwbzxnrrheusugvdbvzvxcjhseljavvsz...

output:

3

result:

ok 1 number(s): "3"

Test #50:

score: 0
Accepted
time: 13ms
memory: 5024kb

input:

1
bsveyuhxauohfxrrpacyhnggjsomrmtmrtjeznmawxpvsgwswhqhtrhmmxawkwqxrmropkhfhuorhaqdzmwckoinuqftgrpucpqufbinkkdzmfyybzzivokiqwvefycyojusbownzcapnbomuwmzfuvvuukxniqefhpwxkrowtohtoabihwkyxvevefysiigsqpeegajurkngycdfwxpsbuuedvsnzoknkarjbmndbnnffotnkaycowkuntrbiaojcaoxeifhxmqzbfaitmqgfxsukabmdzoiuzcwvmzau...

output:

7

result:

ok 1 number(s): "7"

Test #51:

score: 0
Accepted
time: 7ms
memory: 4508kb

input:

1
kcqgcgkhwwwhhkqhwqhhckgwcwwqqcwcgwgwgcwcqcwwqgwkhwwhqqqkwwghqqqhqggkgqggwwwkhqwhgckckcqkkcwkgkkcccghccgcwhqckwkqchkwkcqghgqhhcwhgwcccghchqwgwcckwwkhgqwqhkhhgkgwwqgcqcccchgkqqgkcwkgwcghhgqgwgcqgwhwckccccqwchckkkkqghkhkwghkgkgckqckwgghcckccgghhckghwcwgcwwckghwhwkckkggkgwhcqhwgcgwkwgqwkgwwkgkqwqwhgcg...

output:

5

result:

ok 1 number(s): "5"

Test #52:

score: 0
Accepted
time: 10ms
memory: 4504kb

input:

1
xkqoaqxclqeyzvslbvmqojbeifrzyvapawprrplerlpnwdesdazeyrniizwwzxffnakhqlzistefqtbzjqnkqpsdxztsvexekjdmyvmvajvtcxqsudbupyhnttjsykyywtpyvlkksewivthfchmemkbdrkexwarixvfetjncosfusulvsocbqyfoldptbrrfucobqxabmwwdimdnowfndplioymbnjcljjpbottytaybkpekelxkmymaiaoqcbaicaewvjabmyxbrwyshnffkkleewwdptfqviwtiibhaq...

output:

109

result:

ok 1 number(s): "109"

Test #53:

score: 0
Accepted
time: 17ms
memory: 3560kb

input:

2
tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt...

output:

2000000
1999998

result:

ok 2 number(s): "2000000 1999998"

Test #54:

score: 0
Accepted
time: 25ms
memory: 5488kb

input:

1
rrrqrrqqqqrqqrrqrqqrqrqrqrrqqqrqqrrrqqrqrrrqrqqqqqrqqrqrqqrqrrrqqrqrrrqqqqrqqrrrrrrrqrqrqrrrqqqqqrqrrqrrqrqrqqrrrqrqrqrrrrqqqrrqrrrqrqqqqqrqqrrqqrrrqqrrrrqqqqqrrqrqqrqrqrqrrrrrqrrqqqqrqrrqrrrrrrqqqqqrqqrrqqrqrrrrqrrqrqqrqrqqrqrqqrrqqqrrrrrqqqrqrrqqqrqrqqrqqrqqqrqqqrrrrqrqrrrqqrrqrrqrrrrrqqrqrrrrqq...

output:

16

result:

ok 1 number(s): "16"

Test #55:

score: 0
Accepted
time: 11ms
memory: 5420kb

input:

1
lfqtcbmmnautfozpycvzdxtgsfpxqzhoatuejcqjriaqntagfnjxqizsxhaetzjvhpzbdmruigopadtakjczrmrkbptoxnvucxxizcheouvmnkoqxnrhvggaybegujavzsafpoxglsbmzrimyleexezznhdhthrrjhzbbqbvljcdfufdutpdkxujitdeoufkvuhmongyopvhifzetiqzlskmxpgobqjhdslercqpryaltggzvgllgplimxbodmarctnzypqdordoevbnfcssiglgryklsrfgkbmpyocucu...

output:

1

result:

ok 1 number(s): "1"

Extra Test:

score: 0
Extra Test Passed