QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#802980#1455. String AlgorithmcwfxlhAC ✓6864ms36748kbC++142.5kb2024-12-07 15:27:422024-12-07 15:27:45

Judging History

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

  • [2024-12-07 15:27:45]
  • 评测
  • 测评结果:AC
  • 用时:6864ms
  • 内存:36748kb
  • [2024-12-07 15:27:42]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,sa[500003],x[500003],y[500003],ht[500003],tot,zfj,cnt[500003],lg[500003],ST[500003][23],cs;
ll ans;
string s;
int LCP(int xx,int yy){
	if(xx==yy)return n-xx+1;
	xx=x[xx];
	yy=x[yy];
	if(xx>yy)swap(xx,yy);
	return min(ST[xx+1][lg[yy-xx]],ST[yy-(1<<lg[yy-xx])+1][lg[yy-xx]]);
}
int stk[500003];
bool chk(int l1,int r1,int l2,int r2){
	if(r1-l1+1!=r2-l2+1)return false;
	int uu=LCP(l1,l2);
	if(uu>=r1-l1+1)return true;
	l1+=uu+1;
	l2+=uu+1;
	if(l1>r1)return true;
	return (LCP(l1,l2)>=r1-l1+1);
}
bool comp(int X,int Y){return x[X]<x[Y];}
int flg;
bool comp2(int X,int Y){
	if(LCP(X,Y)<cs-1)return x[X]<x[Y];
	return x[X+cs]<x[Y+cs];
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>s;
	for(int i=2;i<=500000;i++)lg[i]=lg[i>>1]+1;
	zfj=max(n,300);
	for(int i=1;i<=n;i++)cnt[x[i]=s[i-1]]++;
	for(int i=1;i<=zfj;i++)cnt[i]+=cnt[i-1];
	for(int i=n;i;i--)sa[cnt[x[i]]--]=i;
	for(int k=1;k<=n;k<<=1){
		tot=0;
		for(int i=n-k+1;i<=n;i++)y[++tot]=i;
		for(int i=1;i<=n;i++)if(sa[i]>k)y[++tot]=sa[i]-k;
		for(int i=1;i<=zfj;i++)cnt[i]=0;
		for(int i=1;i<=tot;i++)cnt[x[y[i]]]++;
		for(int i=1;i<=zfj;i++)cnt[i]+=cnt[i-1];
		for(int i=tot;i;i--)sa[cnt[x[y[i]]]--]=y[i];
		for(int i=1;i<=tot;i++)swap(x[i],y[i]);
		tot=0;
		for(int i=1;i<=n;i++){
			if(i==1||y[sa[i]]!=y[sa[i-1]]||y[sa[i]+k]!=y[sa[i-1]+k])x[sa[i]]=++tot;
			else x[sa[i]]=tot;
		}
	}
	for(int i=1;i<=n;i++)x[sa[i]]=i;
	for(int i=1;i<=n;i++){
		if(x[i]==1)continue;
		if(i==1)ht[x[i]]=0;
		else ht[x[i]]=max(ht[x[i-1]]-1,0);
		while(i+ht[x[i]]-1<n&&sa[x[i]-1]+ht[x[i]]-1<n&&s[i+ht[x[i]]-1]==s[sa[x[i]-1]+ht[x[i]]-1])ht[x[i]]++;
	}
	for(int i=1;i<=n;i++)ST[i][0]=ht[i];
	for(int i=1;(1<<i)<=n;i++){
		for(int j=1;j+(1<<i)-1<=n;j++)ST[j][i]=min(ST[j][i-1],ST[j+(1<<(i-1))][i-1]);
	}
	for(int i=1;i<=n;i++){
		tot=ans=0;
		for(int j=1;j+i-1<=n;j+=i)stk[++tot]=j;
		if(i>=200){
			sort(stk+1,stk+tot+1,comp);
			for(int j=1;j<=tot;j++){
				for(int u=j+1;u<=tot;u++)ans+=chk(stk[j],stk[j]+i-1,stk[u],stk[u]+i-1);
			}
		}
		else{
			sort(stk+1,stk+tot+1,comp);
			for(int j=1,u=1;j<tot;j++){
				while(u+1<=tot&&LCP(stk[j],stk[u+1])>=i)u++;
				ans+=(1-i)*(u-j);
			}
			for(int j=1;j<=i;j++){
				cs=j;
				sort(stk+1,stk+tot+1,comp2);
				for(int u=1,o=u;u<tot;u++){
					while(o+1<=tot&&LCP(stk[u],stk[o+1])>=cs-1&&LCP(stk[u]+cs,stk[o+1]+cs)>=i-cs)o++;
					ans+=o-u;
				}
			}
		}
		cout<<ans<<'\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 15420kb

input:

7
kkekeee

output:

21
2
1
0
0
0
0

result:

ok 7 numbers

Test #2:

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

input:

10
babaiskeke

output:

45
2
0
0
0
0
0
0
0
0

result:

ok 10 numbers

Test #3:

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

input:

11
aaabaaabaaa

output:

55
10
2
1
0
0
0
0
0
0
0

result:

ok 11 numbers

Test #4:

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

input:

50
vgjanpqrpxaqzckoaokxemqghpgeehegwjiqifenfpnttwbibs

output:

1225
21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 50 numbers

Test #5:

score: 0
Accepted
time: 2ms
memory: 14140kb

input:

50
sngyxnmwrlyyhrplimxorsrvvllpykxxsuvoupoowyrwfvtwsl

output:

1225
32
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 50 numbers

Test #6:

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

input:

50
nzpywqxywyyqwmvrrzxvunzvqltovxppyynvylxxlqwwxpxqqs

output:

1225
42
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 50 numbers

Test #7:

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

input:

50
qpytzpzuzryyyywzwvzrzwvzlqvnysuqosxpwzzwysmvwwwysw

output:

1225
52
3
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 50 numbers

Test #8:

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

input:

500
wxntkuresxqhrfasoqgmzorcehxjcqooxsncdxgetjstfdpxwjihwfpnqbbioztozfegasscvzswwxmttvwgbxrbsbvkhjbmjwvquzxjinlyzoxhqkuflgihcaudnyoghubfykllruerubkcsmdbzsmknmzexkkvzmkxjrurcloufqcutwjknlohowgtwubymizrvjiiqnrbnxrgvoiwheiydxipsryynhmzoawzmyhxwwqizehnvvrgpbntaaggpqolumkjeduxxfxtgdbngmlwjbozgvztsgnndwhm...

output:

124750
2304
67
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 500 numbers

Test #9:

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

input:

500
szylxznqzzpzxwxtzvvrxyvyzytsvzsvswsumqyvzpzzqsywwwzsxutupzuwwuxwpqympzxowyrzwsvzyymzytuwuprkvtxvxwtzwtzxtrttvzwszzstuqtxyzmpoxytwvvyuvszuryyqytozysztrpvmxzzzsxxpjwtryowynsytkyzyzuyslywvvzquvzyzuzxyxnrqtwsvvzuzywtzgzgvznvzxuzvxzxzsyxyszxrjruzuwrzystzzpyqwqxzvytzwxrzysugpwxnyoylxxvxvywmwlywxruxpsu...

output:

124750
5207
325
20
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 500 numbers

Test #10:

score: 0
Accepted
time: 2ms
memory: 15720kb

input:

500
yzzyzzyyyxzyzxvszxuyzyxxyzwzzuyzzxvxxyyzzxxzwztzzzywxwzzyxzzxzxvzvzyzyxyzyyzzvtwxyvzzzzyyxvzzuvxyyvzyuyyzzwyzzvzztzwzyyzzvyuzzzzyzzzwwxyxzxvyuuzxzyuzzyxxyuyzxxzyzxzxyzvzxzzyyzxxuzyuvzzyszzwyttszzxyxzwzyxzzyztxyzzxzzzzxxxzzxyzvzwwvztywyxuyuzyzxxuyxzvzxzvrywytwuyvtyxxyxxzzyyvuzvvzwyzzzxsywzyzzwwzz...

output:

124750
12361
1779
287
61
14
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 500 numbers

Test #11:

score: 0
Accepted
time: 2ms
memory: 15652kb

input:

500
zzyzzzyzyzyzyxzyzzzyyxzyzzzzzzzzzzxyyzzzzzzzyzzzxyzzzzzzzyyyzzyzxzzyzzzzyzzxzyyzzzzyzwzzzzzyzzzzzzzyzzzzzzzxzzzzzzwzzxyzzzzzzyzzuzyzxzzzyzzxzyzyyzzxzzyyzzzwzyzzyzyzyyzzzzzyzzxyzxzzzzzxzzzwzzyyzzzyyzyxyywzzzzzzzzzyzzzzzzzzzzyzzzzzwzzzyyzyzzyzzzzzyzzzyzzzyzyzzvzzzzzyzzzywzyzzzzzyzzwzzzzyzzyzzzzzzy...

output:

124750
25306
8168
3162
1233
537
219
110
53
18
12
4
0
1
1
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 500 numbers

Test #12:

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

input:

2000
uzvwxzqszxwzwypyuzrzzokzrhzyypytsyzvzxuzvruwyvujvzpvtvuuxuyztxzstsyxxuwwxzuzsyuqxsyznwzuwwxpuuvzqwtxwqrxxvytquyjtrzxuzzwyxzzxuwzrtxntyxwxyzvvstyvzpzsvxuztuzqtzvywtxyzxtxxsxpnzxovyzzyvnrwyxyzznlqywzwkzlnswxuyuvztxywmxxyvyqwxwwszzywxnpvvrtyydrwwwzyvsrzytrzrojqrnvojtzvqnnxvxylsywoztzzwvlvwsvvxrzqv...

output:

1999000
86828
5220
320
30
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 2000 numbers

Test #13:

score: 0
Accepted
time: 88ms
memory: 17068kb

input:

10000
rhsrvsyyqzsxonvqxxxryzqwuyzypwiqpsvqvwsvvswowuznznpyxzyzyryuypwyuvrsvxyywwszutzqxjpwzyzzysyyzrmztsusyvtpzrmqrzyxqwusswyywtvporwymwxylzvsilxtyzxssvyllrwvzyxuzxpxyzrwyvwurqyzxwviyuzvzfzzstutuxtsxwyywtvzxrxuztiwpwwvzmvxnvxpvoqyxyyyxzmouztvxwryzzyzszrtrwupsvwyyrxszxywzsyozyynzrlxupprnxwyouyuqsuovu...

output:

49995000
2112858
122779
8113
543
52
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 10000 numbers

Test #14:

score: 0
Accepted
time: 725ms
memory: 22588kb

input:

50000
ixxzzrxyyvxuxjzyssqmrwyzzwzsnsjpvxyzuwvyusyolxtpxzzlvxiuutwrxyxksywsxuttzztxzvkktvrztxzyzrowwzrzxxruzwzxzqvovuuvywwrvtwyuqqyuwyxzxmzzzzxtrsqrvvzyuyyxtztxpxhozyzxmyvyysvupsyyzwuxzvszxzzqzxkwwvyxuvvxtpztzyyxwuywqsosutyqyuwzyqyxtsvvrptxwqwzumsxxznntvrwyzxxzyqstxuxqqvivmswxyrvxzvwztxpwuzuvtryzvmxy...

output:

1249975000
52455909
3024419
197627
13719
1014
75
10
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 50000 numbers

Test #15:

score: 0
Accepted
time: 1893ms
memory: 24532kb

input:

100000
yttwuxxrivtyvxpxpwzsvvtuhuwztxuurzxzwuzxzxuynwqzytsyrvzvzxyzzsyqutvxysuyvvvpvyrvxyxrywxxttqxvgpvjuzwovmqpoxtsrxuozvxwyquvszuyyyxvqxvzwwmyyvrzyyzzfyvtxvtztztzzrvrzyyyxrvsrvpzknytxywxrqsvuvzwzyzzyyyizxyiwpcwsyxytvsyuxvmvxxqwxztywwzyyotwxszoxzquwxzywytvvyozxyjrtuuyvmpyuxsuzryylyyzwysyyqxxgqruuvv...

output:

4999950000
209545451
12046079
785540
54925
3991
295
17
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 100000 numbers

Test #16:

score: 0
Accepted
time: 3567ms
memory: 29068kb

input:

150000
vuzzzrzykxmvwzzvvomqltufzyunvjjoyzuzqnsyuxttyvvuuypvxxjxxxyzprryxwyzupyuttltxxwwqzxrwuwzzywtztzuvttzpxvoszruxtlrtxuzwzyvzojzvvqsoruszqqwtxzxsqqzuqukphxzxzsvtvvuxvzmtvzrymvtpwpzuttvyyzwwwivvytzxkszrxzsxqwqryuvystztmyztyuwqrrssytolzytsqyysyvyuztzolzvxtunzwuvhzrvrwzxizphspxtnswrkyytyyzvuxyumoonv...

output:

11249925000
469565848
26925274
1744782
121977
8974
673
59
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 150000 numbers

Test #17:

score: 0
Accepted
time: 5774ms
memory: 36712kb

input:

200000
svvvhqqppfhewxhmeclitlziuowntblgmljpcfgjfaajeixxrmjjuttqpznsmrkiymdfwkfzqqrpketauslquxumajselkqjdztyelhjqtebtquctbbklfiwctosgaspzgkqitpzowfkhvuspnzgagsqviaytknmdmfavkgmmkowhqdtzkzvmfzxyugunddgrvefnfqqoclylvtuhwohmqbvwqdnpjocjdpdnslzfnhraleestxiliiahprzdfnenlrxnodllnpwiyibbezrmcdjgaputdwceotym...

output:

19999900000
377209698
9603666
276150
8570
281
14
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 200000 numbers

Test #18:

score: 0
Accepted
time: 5712ms
memory: 33548kb

input:

200000
zuzqwyutyynuuvpyywzxsvsovvlynyttxwzhzqszwtwzqwzysxxfwxyswzurqyonwvvvpwuwpvqnzszzwoyvzzuvwsxqxlxxzxxnqtxwrmzxuzkylnyywvrwyzvwqzquxtqunxrrzxwjzyqwvtrzryvstmxymzvxpywxqtvyxttzrzuuhixvurrrvlwxqwzuzwxirtxrwsuqvyvxtvstkzqwwzotxywhrzplvtlvxvwyyytyryoqyphxsxwvwrvvyvuyzxyywwwyxtwyytmlwyyryuztzyzwyuupz...

output:

19999900000
836271472
47956789
3116604
216013
15637
1158
98
6
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 200000 numbers

Test #19:

score: 0
Accepted
time: 5752ms
memory: 36268kb

input:

200000
xzyyxzyzuxzwzzzwxxyxzwsyxvxyyzzxxyxwwtxzyxyyzzvyzxzxwwtwyyzzyxvzxxuzwzywyxzxxuxzzryvvxyzzzyzzzzxzxwzxyyzzzyzxzwtuzwywxwzvvyzzyxzyzzywzzxyyzuyzywwzyxxzzvzuzxyyzytzyzzzszwzxzzzzszyvzyzzzyzzzxyyyzuzwzzyzxzzzzvpztyzxxyxxyxtyxzzzzttyvywyzzyxtuyyywyyyzxxwuvzvzwwzwyyvyxxzyywyzzzzzwwyxvzwyuwyyyyyyyzy...

output:

19999900000
1948144620
272200389
43759959
7562451
1365650
249293
48011
9115
1945
377
66
9
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 200000 numbers

Test #20:

score: 0
Accepted
time: 5827ms
memory: 33548kb

input:

200000
zyyzyyzzzzyzzyyzzzzzzzwyzzwzyxzzzzzzzzyzzyyzzzwzzxzzzzzzzzzzyzzzzzyzzyxzzzyzyzzzzzzwzzzzzyzzwzzzzzzyzzzyyyzxzzzxzzzzzxzyyzzzzzyyxxzzzzzxzxyzzzyzzzzzzzzzyzyzzxxzzzzyzzzzxzzyzzzzxzwzzzyzyzzxzzzzzzzzzyyzzzyyzzzzzyyzzzzzzyzyzzzyzzyzzzzzyzzzzzzzzzzzyxzyzzzzzzzyzzzzzzzxzzwzzxzyzzwyzzzzzyzzzxyyyzzyz...

output:

19999900000
3959980692
1257993529
476678310
197946906
86859093
39561937
18237256
8711393
4221673
2075791
995638
497061
250700
131452
65700
32664
16200
8174
4673
2275
1216
571
329
153
99
33
25
9
14
4
5
1
2
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 200000 numbers

Test #21:

score: 0
Accepted
time: 760ms
memory: 20504kb

input:

50000
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh...

output:

1249975000
312487500
138869442
78118748
49994998
34715275
25500508
19528123
15426232
12497498
10326237
8675692
7393932
6374232
5552775
4881247
4323267
3854473
3459762
3123747
2831007
2579853
2359875
2168400
1998997
1848000
1712172
1592217
1485223
1386942
1298463
1219138
1146852
1079712
1018875
96257...

result:

ok 50000 numbers

Test #22:

score: 0
Accepted
time: 1953ms
memory: 24800kb

input:

100000
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

4999950000
1249975000
555527775
312487500
199989997
138869442
102023468
78118750
61721602
49994997
41309502
34715275
29579583
25500509
22214442
19528125
17296018
15426232
13846950
12497497
11331177
10326237
9446028
8675692
7997997
7393932
6854250
6374233
5942625
5552775
5198697
4881250
4588932
43232...

result:

ok 100000 numbers

Test #23:

score: 0
Accepted
time: 4144ms
memory: 30448kb

input:

150000
lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...

output:

11249925000
2812462498
1249974998
703106248
449984997
312487498
229568878
175771873
138869442
112492497
92963428
78118748
66556950
57389539
49994997
43940623
38918250
34715275
31153668
28121247
25500509
23239150
21258457
19528123
17996997
16637793
15426232
14346044
13372203
12497497
11700700
1098163...

result:

ok 150000 numbers

Test #24:

score: 0
Accepted
time: 4298ms
memory: 30900kb

input:

150000
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

11249925000
2812462479
1249974972
703106215
449984965
312487463
229568840
175771834
138869406
112492462
92963392
78118709
66556911
57389499
49994957
43940584
38918210
34715239
31153630
28121208
25500467
23239111
21258419
19528083
17996958
16637752
15426191
14346003
13372162
12497456
11700660
1098159...

result:

ok 150000 numbers

Test #25:

score: 0
Accepted
time: 5897ms
memory: 35580kb

input:

200000
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc...

output:

19999900000
4999950000
2222144445
1249975000
799980000
555527778
408136735
312487500
246897531
199990000
165265290
138869445
118326036
102023470
88877778
78118750
69189966
61721605
55393075
49995000
45339003
41309505
37797165
34715278
31996000
29579586
27428121
25500511
23773960
22214445
20804475
19...

result:

ok 200000 numbers

Test #26:

score: 0
Accepted
time: 5992ms
memory: 35164kb

input:

200000
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr...

output:

19999900000
4999949999
2222144444
1249974999
799979999
555527777
408136735
312487499
246897530
199989999
165265290
138869444
118326036
102023469
88877777
78118749
69189965
61721604
55393074
49994999
45339002
41309504
37797164
34715277
31995999
29579585
27428120
25500510
23773959
22214444
20804474
19...

result:

ok 200000 numbers

Test #27:

score: 0
Accepted
time: 6480ms
memory: 35596kb

input:

200000
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh...

output:

19999900000
4999949998
2222144443
1249974998
799979997
555527775
408136732
312487497
246897529
199989997
165265287
138869442
118326033
102023467
88877775
78118747
69189964
61721602
55393072
49994997
45339000
41309502
37797162
34715275
31995997
29579583
27428118
25500508
23773957
22214442
20804472
19...

result:

ok 200000 numbers

Test #28:

score: 0
Accepted
time: 6864ms
memory: 33488kb

input:

200000
ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg...

output:

19999900000
4999949984
2222144413
1249974971
799979963
555527740
408136698
312487465
246897490
199989962
165265249
138869407
118325995
102023429
88877735
78118709
69189926
61721561
55393032
49994958
45338959
41309461
37797122
34715237
31995955
29579544
27428077
25500467
23773916
22214401
20804431
19...

result:

ok 200000 numbers

Test #29:

score: 0
Accepted
time: 725ms
memory: 20928kb

input:

50000
dzwtdzmncpwfosbbwlrlraaphgniyqiljuyofdqzbcfknmjpvoybftolhnmzecfspeawustiphkerxtgmriohyriqgozixbdddzprsviaraxbzvogymzgvvxuyhtrwfcvrvmoiibxoodqwgzegbvrvbwwwpkenlcrsqwwovszdirbsneksvotpthsrbhuuylqrwreqddkdjmobcnmdiobvfuyhmgoemfjabmbmaodjdjladmgscetbqdetzkthhupgxirekezanexdpzusdiqwxneutsbmoovqbneh...

output:

1249975000
23586142
599073
23437
5500
21
1
3100
0
2480
0
0
0
0
0
1550
0
0
0
1240
0
0
0
0
992
0
0
0
0
0
800
775
0
0
0
0
0
0
0
620
0
0
0
0
0
0
0
0
0
496
0
0
0
0
0
0
0
0
0
0
0
400
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
310
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
248
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 50000 numbers

Test #30:

score: 0
Accepted
time: 1975ms
memory: 25668kb

input:

100000
hmqckpztbvideyvwtvgdvbyflbkajhmfoytvqdctycjmpssqzscpteszsgwueyznhhrdzcbttqgpyqirudgtnqmaqzxrcqhmocdhtvhzkgdnguturxomrygwcenrxsdscxrsikngpzserdwbuipyzlyleiqflkiiafqphdqycbplhessusuhiatoqzrhcfsfugzgfausickfpiovlsrxtqjvbfdafolkmuogmbvaticwajbibklulhikragrlbkohzwelquqyujlwfgtpjwrxnvsndbxhnzzdrjao...

output:

4999950000
94326289
2417542
81557
12050
8340
4
6225
0
4980
0
4150
0
0
3320
0
0
0
0
2490
0
0
0
2075
1992
0
0
0
0
1660
0
0
0
0
0
0
0
0
0
1245
0
0
0
0
0
0
0
0
0
996
0
0
0
0
0
0
0
0
0
830
0
0
0
0
0
0
0
0
0
0
0
0
0
0
664
0
0
0
0
0
0
0
600
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
498
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #31:

score: 0
Accepted
time: 3816ms
memory: 31436kb

input:

150000
omgqrakgnpelbssesmphwhepzglbuxpviuaatmfwbtbobdwbywhlndxgghnxrsqvepkvtzqdkacftmnvkztkwnjvqotfwbaexnolwrernlynehjwwpleobwwbjievmpmfoxegjxisamcxgfychetqdzqljovtdawhkuwqujtivwlnyloxopbfqtjpvteabptwengeejyhbdrbixrzvhcymwhlgmutkocaaclbivbfmmivwumvpwnuvcvcdqmssmxwjcvvylmoodrlpkzhhadibcfgsahunefwuavl...

output:

11249925000
212181738
5405078
155833
5000
157
5
125
0
100
0
0
76
0
0
62
0
0
0
50
0
0
0
0
40
37
0
0
0
0
0
0
0
0
0
0
0
0
0
25
0
0
0
0
0
0
0
0
0
20
0
18
0
0
0
0
0
0
0
0
0
0
0
0
14
0
0
0
0
0
0
0
0
0
0
0
0
0
0
12
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
0
0
0
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8
0...

result:

ok 150000 numbers

Test #32:

score: 0
Accepted
time: 3832ms
memory: 30440kb

input:

150000
ugpwsjjlhmaopuqvkrrijuvkbcxcwllyrovfuxtyfedmqrnpmetepxcosjtwnscxmhextwqnsmvqmdprpqoqaxbvwkmrduzsczcnjspewjkyesdnjkmspzlyvkcswnkonvpzudkdxqvdjixrjxsmvrceqjoruvwqccthbhnhhikhtjiensylfnpyvdnuoslrmzbdyadzlrfgaffzgmtzgdeoqntxceqtcotbjezahcyvkrkqpemttbnoqcilgznqwilofpbkrnrqhdclufqjqltjmyhfhtrbuiyno...

output:

11249925000
212190318
5406309
174086
19846
141
4
9350
0
7480
6800
0
0
0
0
4675
4400
0
0
3740
0
3400
0
0
2992
0
0
0
0
0
0
0
0
2200
0
0
0
0
0
1870
0
0
0
1700
0
0
0
0
0
1496
0
0
0
0
1360
0
0
0
0
0
0
0
0
0
0
0
0
1100
0
0
0
0
0
0
0
0
0
0
0
935
0
0
0
0
880
0
0
850
0
0
0
0
0
0
0
0
0
0
0
748
0
0
0
0
0
0
0
0...

result:

ok 150000 numbers

Test #33:

score: 0
Accepted
time: 6080ms
memory: 36156kb

input:

200000
dqudajreffiwgtmmlhkykznxicdkjoinyhhfusivwqrbdjufhlwuesnalsweulueejbckyyqcghnatvdkzsbnuacknzmjpaqrbcseaualbhparbmsyysienbxyutlzhhlhsubsifhigwptqmrlsevirlwasktkmigacfoiqrsptgccwwdabvcwmivieiectgnftcgzlmsgsmlunmlsgowvyeaxkgqusmysvqdrvtmojjyhknxijutljmhhsiwymsqsydtvdkditvwrzhgilvvakaanwmyipcpkorb...

output:

19999900000
377214246
9606852
275830
8781
265
6
125
0
100
91
0
0
0
0
0
0
0
0
50
0
45
0
0
40
0
0
0
0
0
0
0
0
0
0
0
0
0
0
25
0
0
0
22
0
0
0
0
0
20
0
0
0
0
18
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
11
0
0
0
0
0
0
0
0
0
0
0
10
0
0
0
0
0
0
0
0
0
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8
0
...

result:

ok 200000 numbers

Test #34:

score: 0
Accepted
time: 6158ms
memory: 36592kb

input:

200000
oexjgkocppkldnbgixayqehmovixuntjpwqcykpslbpwzkcgveuumqeutfiquusqgpshuvwejgzfkpadyaskkqselyrbqxhgcmsdeqfkckkpobltpxwvsecwchhrietpknzwidkjzuhsifybfpqcfwddrxnpjokpfifbtogzczsjmhmxuokklxdrjqvhjrqiebiezacxqtawqztkuhqlwrsdminhinmytnfokmnnafsjesigenshuhospgggzvkpxtxyykirnzcnnpanzfcvtaxirlddqsfvkynjx...

output:

19999900000
377259156
9605422
278482
10314
294
13
1251
0
1000
0
0
0
0
0
625
0
0
0
500
0
0
0
0
400
0
0
0
0
0
0
312
0
0
0
0
0
0
0
250
0
0
0
0
0
0
0
0
0
200
0
0
0
0
0
0
0
0
0
0
0
0
0
155
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
125
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
100
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 200000 numbers

Test #35:

score: 0
Accepted
time: 6014ms
memory: 33556kb

input:

200000
fvxwkfaizlkcqoaafxbzbmrujfkwrnrftdwgoppksxtfjjgajjyzyrwvwunazaxqcgjdygnzpqwkekrhgpwbtifabyisaeudpgtjqdqqnmwgbwcypniffujstvwgotdhfdumtanaoalrieglwsoebffvdfhhwejbdicnyonjvqnvosfjigeifbphonpyacczqlwqpckwkppynsxhtgltidbrlxrxcedxzasasphgecrdekxdalgafduuxbnplfxkpdvtdoywqpduohcpmexlealrjpdrjliooqqfu...

output:

19999900000
377267425
9610456
302219
28648
274
11
12479
0
9980
0
0
0
0
0
0
0
0
0
4990
0
0
0
0
3992
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2495
0
0
0
0
0
0
0
0
0
1996
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
998
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 200000 numbers

Test #36:

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

input:

50
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

1225
300
120
66
45
28
21
15
10
10
6
6
3
3
3
3
1
1
1
1
1
1
1
1
1
0
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 50 numbers

Test #37:

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

input:

50
baabaabbabbbaabaaababaaabaaabbbaaaaaabbbbbabaabaaa

output:

1225
227
58
18
7
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 50 numbers

Test #38:

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

input:

50
ccbcccccccbbcccacaccaccbcaacbcaacccbbcbbcbbbbcbbab

output:

1225
184
46
13
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 50 numbers

Test #39:

score: 0
Accepted
time: 4612ms
memory: 35488kb

input:

200000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

19999900000
4999950000
2222144445
1249975000
799980000
555527778
408136735
312487500
246897531
199990000
165265290
138869445
118326036
102023470
88877778
78118750
69189966
61721605
55393075
49995000
45339003
41309505
37797165
34715278
31996000
29579586
27428121
25500511
23773960
22214445
20804475
19...

result:

ok 200000 numbers

Test #40:

score: 0
Accepted
time: 6468ms
memory: 35232kb

input:

200000
bbaaaabbaaabaababaabaabbbababbabbaaabbabbbbbabbabbabbbabbbababaabaaabaabaabbbabbabbbbababaabaaabbbaabaaabaaabaaabbbbbbaabbabbabbabbaaaaaaabbaaabbabbbabaabbbbaaaababbbbaaaaabbaabbbbbbabbababbbabbbbaabbbaaaababbaaabbbbaaababbbbaaaabaabaaaabbabbbabbaabbbaabbababababbaaaaaaaabaaabaabbbabaabbaaaab...

output:

19999900000
3749950502
1111125637
390588937
149989554
60768856
25505026
10987543
4822749
2150535
968303
440514
201916
93120
42989
20184
9680
4499
2030
982
486
221
118
52
26
8
6
2
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 200000 numbers

Test #41:

score: 0
Accepted
time: 6247ms
memory: 35628kb

input:

200000
bbbbbbbbbbbabbabbbbbbbbbbbbbbbbababbbababbbbbabbbabbbbabbbbbbabbbbbbbbababbbbbbbbbbbbbbbbbbabbbbbbbbaabbbabbbbabbbbbbbbbbbbbabbbabbbbbbbbababbbbbabbabbbbbbbbbbbbbbbbbbbabbbabbbabbbbabbbbbbbbaaabbbabbbbbbbbbbbbbbbabbbbbbbbabbbaabbbabbbbbabbbabbbbabbbabbbbbbbbbabbbbbbbbbbabbbbababbbbbbbbbbababb...

output:

19999900000
4763278864
1953231235
990222399
561005173
340657311
216274672
141618889
95072412
65004435
44980037
31493965
22466696
15869621
11598144
8215035
6029467
4421298
3234843
2406589
1769083
1277618
950862
663729
516603
404589
302575
219346
161018
128457
90807
65092
50295
40871
27234
21113
16725...

result:

ok 200000 numbers

Test #42:

score: 0
Accepted
time: 5750ms
memory: 33548kb

input:

200000
aacacaabcbbbcccacaaacccaccacbbabbbbaaaaacbcababcbbcbcbbaaaabaabcaabccabbcccabcccaccbabaacaaacaaacbaabcbaabaaaaaabaacabbbbbbcabacaabbcaacaaabacbcccbabaccbbbcbabcbaacabbaaacacbccccabacabbcabbbaaacbbabaacbabbbbbcbccabacbcaacbbcabaabcbbbbcaccbcacbaccbabcabccccaabaaabcaabcbcbcbcbaccbcacabbcbcaacab...

output:

19999900000
2777751571
576096749
138880202
36219144
9903348
2801527
810256
238637
71054
21264
6654
2016
564
198
83
19
9
2
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 200000 numbers

Test #43:

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

input:

50
mwxmwxmwxmwxmwxmwxmwxmwxmwxmwxmwxmwxmwxmwxmwxmwxmw

output:

1225
92
120
18
12
28
5
3
10
2
1
6
0
0
3
0
0
1
0
0
1
0
0
1
0
0
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 50 numbers

Test #44:

score: 0
Accepted
time: 4523ms
memory: 33616kb

input:

200000
gjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjgjg...

output:

19999900000
4999950000
1111055556
1249975000
399980000
555527778
204061225
312487500
123443210
199990000
82628100
138869445
59159172
102023470
44435556
78118750
34592042
61721605
27693906
49995000
22667121
41309505
18896409
34715278
15996000
29579586
13712209
25500511
11885256
22214445
10400625
1952...

result:

ok 200000 numbers

Test #45:

score: 0
Accepted
time: 5963ms
memory: 33616kb

input:

200000
tvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvtvt...

output:

19999900000
4999949376
1111055152
1249974064
399979505
555526749
204060696
312486420
123442677
199988884
82627559
138868318
59158613
102022332
44434985
78117601
34591463
61720451
27693333
49993830
22666547
41308339
18895829
34714109
15995412
29578406
13711628
25499325
11884659
22213258
10400035
1952...

result:

ok 200000 numbers

Test #46:

score: 0
Accepted
time: 4791ms
memory: 35436kb

input:

200000
umqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqumqum...

output:

19999900000
1666616667
2222144445
416641667
266646667
555527778
136036055
104154167
246897531
66656667
55082370
138869445
39436884
34003062
88877778
26035417
23059401
61721605
18460850
16661667
45339003
13766805
12596157
34715278
10662667
9857298
27428121
8497790
7922355
22214445
6932675
6507292
183...

result:

ok 200000 numbers

Test #47:

score: 0
Accepted
time: 6183ms
memory: 33556kb

input:

200000
uicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicuicui...

output:

19999900000
1666649847
2222143721
416641409
266646381
555526889
136035749
104153861
246896561
66656310
55082037
138868460
39436544
34002737
88876764
26035078
23059066
61720580
18460518
16661327
45337965
13766453
12595813
34714242
10662341
9856967
27427078
8497437
7922020
22213409
6932323
6506947
183...

result:

ok 200000 numbers

Test #48:

score: 0
Accepted
time: 5342ms
memory: 35600kb

input:

200000
rsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehnwrsjehn...

output:

19999900000
714235715
317420636
178546429
114265715
79346826
408136735
44630358
35261553
28561429
23601536
19831350
16897127
102023470
12691112
11154465
9879240
8812611
7908786
7137858
45339003
5897463
5395869
4955755
4567429
4222359
3915129
25500511
3393325
3170636
2969304
2787054
2620085
2468340
1...

result:

ok 200000 numbers

Test #49:

score: 0
Accepted
time: 6019ms
memory: 33636kb

input:

200000
ccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwqtccegwq...

output:

19999900000
1122429483
317430047
178546287
114265579
79346700
408135733
44630170
35261398
28561262
23601355
19831193
16896981
102022380
12690942
11154299
9879081
8812451
7908626
7137706
45337881
5897300
5395711
4955593
4567278
4222185
3914972
25499375
3393170
3170465
2969151
2786884
2619936
2468168
...

result:

ok 200000 numbers

Test #50:

score: 0
Accepted
time: 5593ms
memory: 34864kb

input:

200000
fenfhxoomthoaauxqsojnixexzecuhaineqekknrzfeopvupcsazfenfhxoomthoaauxqsojnixexzecuhaineqekknrzfeopvupcsazfenfhxoomthoaauxqsojnixexzecuhaineqekknrzfeopvupcsazfenfhxoomthoaauxqsojnixexzecuhaineqekknrzfeopvupcsazfenfhxoomthoaauxqsojnixexzecuhaineqekknrzfeopvupcsazfenfhxoomthoaauxqsojnixexzecuhain...

output:

19999900000
650847042
49276234
96128847
15364620
21350428
7834779
24025962
4737138
7682310
3169269
10674573
29575740
3917115
1702656
6003367
1324812
2368569
1060096
3841155
867237
1584460
722609
2666560
611388
14787870
523838
1958283
453816
851200
396924
1499280
350088
662406
311086
1184071
278203
5...

result:

ok 200000 numbers

Test #51:

score: 0
Accepted
time: 5876ms
memory: 36660kb

input:

200000
mffggjgyhawgmcfsckucdbzycdsbeprnsyxvwugapfxzbhjeizbemffggjgyhawgmcfsckucdbzycdsbeprnsyxvwugapfxzbhjeizbemffggjgyhawgmcfsckucdbzycdsbeprnsyxvwugapfxzbhjeizbemffggjgyhawgmcfsckucdbzycdsbeprnsyxvwugapfxzbhjeizbemffggjgyhawgmcfsckucdbzycdsbeprnsyxvwugapfxzbhjeizbemffggjgyhawgmcfsckucdbzycdsbeprns...

output:

19999900000
488176608
57496412
96128761
15364595
21350390
7834757
24025866
4737119
7682263
3169247
10674484
29575461
3917063
1702634
6003277
1324793
2368526
1060078
3841048
867216
1584424
722585
2666468
611363
14787272
523817
1958200
453792
851155
396906
1499199
350065
662360
311071
1183991
278182
5...

result:

ok 200000 numbers

Test #52:

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

input:

16
abbabaabbaababba

output:

120
12
9
2
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 16 numbers

Test #53:

score: 0
Accepted
time: 6261ms
memory: 36748kb

input:

200000
abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbab...

output:

19999900000
2499950000
1126698715
624975000
177829510
95181272
36839491
156237500
14124090
16677641
6877779
24006650
4101333
5662362
2576906
39056250
1696473
2694846
1149008
4171580
903993
1430009
651995
6071972
497746
818050
398950
1414801
306309
573655
257037
9762500
219374
365438
168131
682925
14...

result:

ok 200000 numbers