QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#109343#6364. The Most Expensive Giftdo_while_trueAC ✓6ms3932kbC++141.0kb2023-05-28 16:52:492023-05-28 16:52:50

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-28 16:52:50]
  • 评测
  • 测评结果:AC
  • 用时:6ms
  • 内存:3932kb
  • [2023-05-28 16:52:49]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
typedef long long ll;
template <typename T> T Min(T x, T y) { return x < y ? x : y; }
template <typename T> T Max(T x, T y) { return x > y ? x : y; }
const int N = 200010;
int n, nxt[N][3], p[31], vis[31];
char ch[N];
std::vector< std::string > vec;
ll ans;
void check(int x) {
	int cur = 0;
	for(int i = 0; ; ++i) {
		cur = nxt[cur][p[i % x]];
		if(cur > n) {
			int ct = i / x;
			ans = Max(ans, 1ll * ct * ct * x);
			return ;
		}
	}
}
void dfs(int x) {
	if(x)
		check(x);
	for(int i = 0; i < 3; ++i)
		if(vis[i] < 2) {
			++vis[i];
			p[x] = i;
			dfs(x+1);
			--vis[i];
		}
}
void solve() {
	scanf("%d", &n);
	scanf("%s", ch+1);
	for(int j = 0; j < 3; ++j) nxt[n][j] = n+1;
	for(int i = n-1; i >= 0; --i) {
		for(int j = 0; j < 3; ++j)
			if(j + 'a' == ch[i+1]) nxt[i][j] = i + 1;
			else nxt[i][j] = nxt[i+1][j];
	}
	ans = 0;
	dfs(0);
	printf("%lld\n", ans);
} 
int main() {
	solve();return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3640kb

input:

11
abcabacbcac

output:

18

result:

ok 1 number(s): "18"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

10
aaaaaaaaaa

output:

100

result:

ok 1 number(s): "100"

Test #3:

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

input:

10
aabbbabbba

output:

36

result:

ok 1 number(s): "36"

Test #4:

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

input:

10
acaabbacbb

output:

16

result:

ok 1 number(s): "16"

Test #5:

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

input:

10
abbabaabba

output:

25

result:

ok 1 number(s): "25"

Test #6:

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

input:

10
abcbcacabb

output:

16

result:

ok 1 number(s): "16"

Test #7:

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

input:

10
cbccbcbccb

output:

36

result:

ok 1 number(s): "36"

Test #8:

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

input:

10
abaabaabaa

output:

49

result:

ok 1 number(s): "49"

Test #9:

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

input:

10
abaabaabaa

output:

49

result:

ok 1 number(s): "49"

Test #10:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

10
bcbcbcbcbc

output:

50

result:

ok 1 number(s): "50"

Test #11:

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

input:

10
aacacbaaca

output:

36

result:

ok 1 number(s): "36"

Test #12:

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

input:

10
aaaaaacaab

output:

64

result:

ok 1 number(s): "64"

Test #13:

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

input:

10
acacacacac

output:

50

result:

ok 1 number(s): "50"

Test #14:

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

input:

10
abacabacab

output:

25

result:

ok 1 number(s): "25"

Test #15:

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

input:

10
aaabaaabaa

output:

64

result:

ok 1 number(s): "64"

Test #16:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

10
ababacabab

output:

32

result:

ok 1 number(s): "32"

Test #17:

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

input:

10
aaaaabaaaa

output:

81

result:

ok 1 number(s): "81"

Test #18:

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

input:

10
aaaaaaaaaa

output:

100

result:

ok 1 number(s): "100"

Test #19:

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

input:

10
aaaaaaabaa

output:

81

result:

ok 1 number(s): "81"

Test #20:

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

input:

10
abacabacab

output:

25

result:

ok 1 number(s): "25"

Test #21:

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

input:

100
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

10000

result:

ok 1 number(s): "10000"

Test #22:

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

input:

100
abaaabaabaabbabbabbaaabbbbbbabbbababaaaaabbaaabbbababbbaabaabababababbbabaaaababaababbabbbabbbabaabb

output:

2704

result:

ok 1 number(s): "2704"

Test #23:

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

input:

100
ccbcbcccbcbbbabaabcacbbabbbcbcbcbabbbababbcbaccaacbaabbbccccbcbabcbbcacbbbcaacababbacbaaaaacbaaaacbc

output:

1681

result:

ok 1 number(s): "1681"

Test #24:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

100
abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabba

output:

2500

result:

ok 1 number(s): "2500"

Test #25:

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

input:

100
abcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcbcacababccababcbcaa

output:

1156

result:

ok 1 number(s): "1156"

Test #26:

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

input:

100
acaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacaacacaacacaaca

output:

3844

result:

ok 1 number(s): "3844"

Test #27:

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

input:

100
abaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaabab

output:

4096

result:

ok 1 number(s): "4096"

Test #28:

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

input:

100
abaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaa

output:

4489

result:

ok 1 number(s): "4489"

Test #29:

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

input:

100
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbc

output:

5000

result:

ok 1 number(s): "5000"

Test #30:

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

input:

100
bacccbacacbcbababbcabbbbbabacbabcbaacbbbbbbaabbbcbabcbbbbcabbcababccbcbabbcbbbaacbccbbabbbbbbbacbbbb

output:

3136

result:

ok 1 number(s): "3136"

Test #31:

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

input:

100
bcabbabbcbbbbbbbbbbbbcbbcbbbcbbbbbbbbbcbabacbabababbcbbbbbcbbabbbbbaabbbbbbbbbbbbbcbbbbbacabcbbbbbbb

output:

5776

result:

ok 1 number(s): "5776"

Test #32:

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

input:

100
abababababababababababababababababababababababababababababababababababababababababababababababababab

output:

5000

result:

ok 1 number(s): "5000"

Test #33:

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

input:

100
cbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbca

output:

2500

result:

ok 1 number(s): "2500"

Test #34:

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

input:

100
aaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaab

output:

5776

result:

ok 1 number(s): "5776"

Test #35:

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

input:

100
ababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaabab

output:

2916

result:

ok 1 number(s): "2916"

Test #36:

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

input:

100
aaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaa

output:

7056

result:

ok 1 number(s): "7056"

Test #37:

score: 0
Accepted
time: 1ms
memory: 3604kb

input:

100
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

10000

result:

ok 1 number(s): "10000"

Test #38:

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

input:

100
aaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaa

output:

7744

result:

ok 1 number(s): "7744"

Test #39:

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

input:

100
abacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabac

output:

3364

result:

ok 1 number(s): "3364"

Test #40:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

1000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1000000

result:

ok 1 number(s): "1000000"

Test #41:

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

input:

1000
bababbbababaabbbbababaaabbabbaabaabbabbbbbbbabbbabbbababbbbabaabbbabbaaaaaabbaababbbabbaaaabaababaaabbbbbaabaabbaabbaabbabbbabbbaaaaabbabbbbbbabaaaaabaaabaaabababaaaaababbbaabbaaaaabbbbaabaaaaabaabbaaabbabbbbababbabbbaaaaaaaabbbababaaabaabaabbaababaaabbababbaaaabbbaaabbbaabbababbaaaaabbbaababab...

output:

260100

result:

ok 1 number(s): "260100"

Test #42:

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

input:

1000
acbbcacabacccbabcabccccccbaabccaccbcbacccabbaaacbcbbaccbcabcaacbbbbcccabcccbacccabbbcaaacbaabbaccacaccabbbbbbbacaabaaaacaaaaaaabccabbcaaaaabcacabbacacacaaabccbaabbbaccccaaaabbaccbacabccacbbbacbabcabaaacbcacabacbacbaaaabcbcaaaccacaaabbabaabbcaccbcccbccabcabaccbcccbbacbbaabccabccacabbcabccabaaabb...

output:

116964

result:

ok 1 number(s): "116964"

Test #43:

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

input:

1000
abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaa...

output:

250000

result:

ok 1 number(s): "250000"

Test #44:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

1000
abcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcacababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacaba...

output:

111556

result:

ok 1 number(s): "111556"

Test #45:

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

input:

1000
abaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaabab...

output:

381924

result:

ok 1 number(s): "381924"

Test #46:

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

input:

1000
abaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaaba...

output:

413449

result:

ok 1 number(s): "413449"

Test #47:

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

input:

1000
abaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaa...

output:

444889

result:

ok 1 number(s): "444889"

Test #48:

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

input:

1000
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcb...

output:

500000

result:

ok 1 number(s): "500000"

Test #49:

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

input:

1000
cabaccccbbbaccaccbccbccbbbaccbcccbccbbcacabcaccacaccaacbcbacbcbcabbbbcaccabbcccbacaabccbbccacccbbccbcbbbbcccaccbbbcbcbcccacbcacaaacbbbcbcccaacbbbbcacacbccacabcbbccaababccbccbccbcacabcacaacccbcbcbbcaccccbbacccccacbcacaccbabccccabcacccabbacaccccbcccccaabcccaccabcccacaccacccbbaabcccccccaabcabaccab...

output:

267289

result:

ok 1 number(s): "267289"

Test #50:

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

input:

1000
bcccacccabcabacccccccccccccabccacccccccbbacaccaccccaacacccccccaaccbaacccbccaccaaccbccaccaacbcccccbccacacccccaccacccccacaacabbbaccccbccaacaccaccacbccccacccbacccaacccaacacccccccccccccccbbacacccacacaacccbccacbccccccaccaccccaacacbccaaccacaaaaacacccacacccacabaccabcccabacccaaccccaacacccccccccbbccccaa...

output:

408321

result:

ok 1 number(s): "408321"

Test #51:

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

input:

1000
bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

500000

result:

ok 1 number(s): "500000"

Test #52:

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

input:

1000
cacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcac...

output:

250000

result:

ok 1 number(s): "250000"

Test #53:

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

input:

1000
aaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaabaaabaaabaaabaaacaaabaaabaaabaaacaaabaaa...

output:

580644

result:

ok 1 number(s): "580644"

Test #54:

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

input:

1000
ababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababaca...

output:

284089

result:

ok 1 number(s): "284089"

Test #55:

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

input:

1000
aaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaaaaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaaba...

output:

702244

result:

ok 1 number(s): "702244"

Test #56:

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

input:

899
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

808201

result:

ok 1 number(s): "808201"

Test #57:

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

input:

1000
aaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaaaaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaa...

output:

774400

result:

ok 1 number(s): "774400"

Test #58:

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

input:

1000
abacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacaba...

output:

339889

result:

ok 1 number(s): "339889"

Test #59:

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

input:

9995
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

99900025

result:

ok 1 number(s): "99900025"

Test #60:

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

input:

9995
bababaaabaabaabbabbabbaaabbbbbbabbbababaaaaabbaaabbbababbbaabaabababababbbabaaaababaababbabbbabbbabaabbbbbaababaaaabaaaaaabaabbaaaabbaaababbbabbaabaababbbaabbbbaabbbbabbaabbabababaaabaababaabaabababbabbbabaaabaaabaabbaabbaabababaaaaabaabbabbbaaaabbbabbabbbaaabaaaabbbbaabbaaaabaabbaaaaaababbbaaa...

output:

25391521

result:

ok 1 number(s): "25391521"

Test #61:

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

input:

9995
aaccabbbcbbbcacaacbbccbbbccacabcaccbaccbccbaaaabbbcabbcbbbcabcaabbcbacccaabbcbcbcbccccccccccccccacbccaaaabacbbccbbcccbbcbacbcaabcbbcaccbbcabaabaacaacccbcbaaacbacacbabcaaaaabbbbcaaccaababbcabacbcaacbaababbacaaababacaaabcaacbaababbaabacababacaccbabbccaaaacbaacbcbbcbaccbbccbbccbaaaaabbacbacabbbbaa...

output:

11202409

result:

ok 1 number(s): "11202409"

Test #62:

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

input:

9995
abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaa...

output:

24980004

result:

ok 1 number(s): "24980004"

Test #63:

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

input:

9995
abcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcacababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacaba...

output:

11102224

result:

ok 1 number(s): "11102224"

Test #64:

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

input:

9995
bcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbbcbcbbcbcbbcbbcbcbbcbcbbcbbcbc...

output:

38155329

result:

ok 1 number(s): "38155329"

Test #65:

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

input:

9995
abaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaaba...

output:

41293476

result:

ok 1 number(s): "41293476"

Test #66:

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

input:

9995
abaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaa...

output:

44395569

result:

ok 1 number(s): "44395569"

Test #67:

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

input:

9995
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcb...

output:

49940018

result:

ok 1 number(s): "49940018"

Test #68:

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

input:

9995
caccaacabcacccabaaaabcbcaacbccbacaabbaaacabcacaacbaccabccbbbcaacbabaababbaababacababaaabaccbaacacccaaacaabbbcabbcabcccacbcbaaabbcbaabbbaabaacacbbaacacaacbabbccbaacacbacacacbcbcabcaaaaaaaabaaaabaacabbacabaaaabaaacbacacacbabacbacbbcaaacaaaccaabbabcabbbccaaccacaccabcbbbaacbbbaaacccaacacabbabacccaa...

output:

24561936

result:

ok 1 number(s): "24561936"

Test #69:

score: 0
Accepted
time: 4ms
memory: 3736kb

input:

9995
acaaaaaababaaaababbaacacbbacaaaaaaccbabbacabbaabaaaababbbbaaacaabcbaaacababaaaabaaaaaacaacabbbabbcbaaaaaabbaaacbabcbaaaabbaaabbabbacaaababababbaaaaaaaacaabaaabaaaababacacaaaabacaaabaabbaabbbaaaaaaaaabbabaaacacccaaabbcaaaacaacacbbbaaaaaaacabaaabbaaaaaaaaaaaaabaabbabaacaaaacaaabcaaacbabbbaabbbaab...

output:

44568976

result:

ok 1 number(s): "44568976"

Test #70:

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

input:

9995
acacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacaca...

output:

49940018

result:

ok 1 number(s): "49940018"

Test #71:

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

input:

9995
abacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacaba...

output:

24980004

result:

ok 1 number(s): "24980004"

Test #72:

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

input:

9995
aaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaabaaabaaabaaabaaacaaabaaabaaabaaacaaabaaa...

output:

58003456

result:

ok 1 number(s): "58003456"

Test #73:

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

input:

9995
ababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababaca...

output:

28430224

result:

ok 1 number(s): "28430224"

Test #74:

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

input:

9995
aaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaaaaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaaba...

output:

70040161

result:

ok 1 number(s): "70040161"

Test #75:

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

input:

899
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

808201

result:

ok 1 number(s): "808201"

Test #76:

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

input:

9995
aaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaaaaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaa...

output:

77281681

result:

ok 1 number(s): "77281681"

Test #77:

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

input:

9995
abacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacaba...

output:

33988900

result:

ok 1 number(s): "33988900"

Test #78:

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

input:

9996
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

99920016

result:

ok 1 number(s): "99920016"

Test #79:

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

input:

9996
aabaabbaaababbbbabbaabaaabababaaaabbbababbbaaaaabaabbaabaabaabbaaabbbabbbbabaaabaaaabbbbbaaaaabbaabbbbabaabaaaabbbbaabbaabbbbaaaaaabababaabaabbabbabbabaaaababababababbaabababbaabaabbaababbbaaabaaabababaabaaaababbaaabaabaaababbbaabbabaababbababaabbbbaababbababaaaababbaaaaaaabbbbaaaababababaabbba...

output:

25270729

result:

ok 1 number(s): "25270729"

Test #80:

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

input:

9996
accbbcbbccbcbcccaccaacaabbbaaaaacacaaababbcbcbaccaabbbbbaaacabbacaabbcbbccacbbcbccabcccabacbacacaccacccbcabbccaababbbacbccccabbcabcbacaacacaccbbbccbccbcbabbcbbcbbabacbaccbccbbacbabbabbaccbababcbcbabacabaaaaaaaccbbbbaccaabbbbacbbbccbbbcacccaabbbcbcaacacabbbaabacccbcbbcbbcccbcaaacaabacccbbcbcbbaa...

output:

11209104

result:

ok 1 number(s): "11209104"

Test #81:

score: 0
Accepted
time: 1ms
memory: 3692kb

input:

9996
abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaa...

output:

24980004

result:

ok 1 number(s): "24980004"

Test #82:

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

input:

9996
abcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcacababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacaba...

output:

11102224

result:

ok 1 number(s): "11102224"

Test #83:

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

input:

9996
abaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaabab...

output:

38167684

result:

ok 1 number(s): "38167684"

Test #84:

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

input:

9996
abaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaaba...

output:

41293476

result:

ok 1 number(s): "41293476"

Test #85:

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

input:

9996
abaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaa...

output:

44408896

result:

ok 1 number(s): "44408896"

Test #86:

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

input:

9996
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcb...

output:

49960008

result:

ok 1 number(s): "49960008"

Test #87:

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

input:

9996
bcbcccabcbcccbbcbccaaacbccbbbcacccacacbcbabccccbcacbcaacbcbacbcaacbcbbcaaaaacbbcaccacaaccabbcaacbacbaaacbbcbaaccbcbccaacacacbabacccccccbaaacccacabcaacccacacbbcccbccbacbcbcbcccbcbaccccbbacbbaacccccaccccacbcccbcccbbacccbcccccbcaabbbacccbacacccbaccbacbcbabcbbaabcaaccbbabccaabbabbccbbaaacccccbccacb...

output:

24206400

result:

ok 1 number(s): "24206400"

Test #88:

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

input:

9996
cbcabbbbabbbbaccbcbbcbbbbbcbcbbbbbababbbbbabcbcbbbbbbcccbcbbbabacbcbabbcbbbcbbbccbcabbbbbbbcabbcbbbbbcbbcbabbbbbbbbbbbcbbbbabbbbbbbbbbbcbbcbbbbbbbbcbbcbbbbcbcbbbabbbccbccbbcbcbbcbbbbcbacbaccbbcccbbbccacbcbccbabbbcbbabccbbbaababbcccccbbbbbbccbbccbbbbbaababbabbbbabcbbbbbbcbbbcbcbbbcccbcbbcbbccbcb...

output:

44542276

result:

ok 1 number(s): "44542276"

Test #89:

score: 0
Accepted
time: 1ms
memory: 3920kb

input:

9996
cbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbc...

output:

49960008

result:

ok 1 number(s): "49960008"

Test #90:

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

input:

9996
acabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabaca...

output:

24980004

result:

ok 1 number(s): "24980004"

Test #91:

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

input:

9996
aaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaabaaabaaabaaabaaacaaabaaabaaabaaacaaabaaa...

output:

58003456

result:

ok 1 number(s): "58003456"

Test #92:

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

input:

9996
ababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababaca...

output:

28430224

result:

ok 1 number(s): "28430224"

Test #93:

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

input:

9996
aaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaaaaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaaba...

output:

70040161

result:

ok 1 number(s): "70040161"

Test #94:

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

input:

899
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

808201

result:

ok 1 number(s): "808201"

Test #95:

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

input:

9996
aaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaaaaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaa...

output:

77299264

result:

ok 1 number(s): "77299264"

Test #96:

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

input:

9996
abacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacaba...

output:

34000561

result:

ok 1 number(s): "34000561"

Test #97:

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

input:

9997
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

99940009

result:

ok 1 number(s): "99940009"

Test #98:

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

input:

9997
aaabaaababaaaabbabaaabaabaaaabaabbaaababababbbbbabaaaaabbabbbaabbabbbbabaabbbababbbbabaaaababaabaabbbbaabaaaabbbaaaabababbbabbbbaabbabbabbbaabaaabbbabbabbababaaaaabbbabbbbbabbaaababbaababbbbbaaaabaabbabaaababbaabaaaaabbbbaabbbbaabaabbabbaabbaababbbaabaaaaabaabbaaabbababaaaabbabbbaaaabbbaabaabba...

output:

25140196

result:

ok 1 number(s): "25140196"

Test #99:

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

input:

9997
caaacccccaccacabbcbcabacbbbcbbcaacccabbbcbcabababbbbcbbcaacbccbaabbbccbcabbaacbbcbccababbcbcbbacacacccabacbabbbacccabaaccabaccabccabaaabcbbbcbcaabbaacbabbacaabbbccbccabbbaabababaaabbaabcaaabacccacbaacaababbccbbbbaaabbacacacacbcbcccaacccccbbbaaaccacbaccbaabccabababcabbbbbaabcbcccababbaaabbccbcba...

output:

11343424

result:

ok 1 number(s): "11343424"

Test #100:

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

input:

9997
abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaa...

output:

24990001

result:

ok 1 number(s): "24990001"

Test #101:

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

input:

9997
abcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcacababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacaba...

output:

11108889

result:

ok 1 number(s): "11108889"

Test #102:

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

input:

9997
caccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccaca...

output:

38180041

result:

ok 1 number(s): "38180041"

Test #103:

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

input:

9997
abaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaaba...

output:

41306329

result:

ok 1 number(s): "41306329"

Test #104:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

9997
abaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaa...

output:

44422225

result:

ok 1 number(s): "44422225"

Test #105:

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

input:

9997
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcb...

output:

49960008

result:

ok 1 number(s): "49960008"

Test #106:

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

input:

9997
bbbbbbccacbbcbbcbcccababcbbbbbcacccbabaabbcbbbbabbcbbcbcabbcaacccbbaccbbcbcabbccbcaaabcbcabbbbbbcbcbbbcbbbbbbcabaaabbabacacbbbbbbccbacaaabbaacaabcbbababbbacbbbcbbbbbbabcccccccbbbbccacbbbabbacabbbcbbbcabbabcbcbbbbcbbbaacabcbcccbabbbbcbbcbbbccbabbbbacbbabcbcacabcbbcabbbabbbbccbacbaacbaabbabbababb...

output:

24820324

result:

ok 1 number(s): "24820324"

Test #107:

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

input:

9997
cccaacccaabcaaccccccbbacaccccbacccabccaccaacbccbcacaccaccacccbaacccccccccccaacacccccabccbcaccccbacbabcccccccacccacccbcbacccbcccbcbccccbcacccccccaacacacccccbcacabcaccaccacacabcacbcccaccacccabccacacccccbcacccccccccacacbcbcacccacacccacbcabccacacacbaccccccccccccccccccccbbbbcabccacaccccacccccccbacba...

output:

44049769

result:

ok 1 number(s): "44049769"

Test #108:

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

input:

9997
cacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacac...

output:

49960008

result:

ok 1 number(s): "49960008"

Test #109:

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

input:

9997
bcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcb...

output:

24990001

result:

ok 1 number(s): "24990001"

Test #110:

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

input:

9997
aaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaabaaabaaabaaabaaacaaabaaabaaabaaacaaabaaa...

output:

58018689

result:

ok 1 number(s): "58018689"

Test #111:

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

input:

9997
ababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababaca...

output:

28440889

result:

ok 1 number(s): "28440889"

Test #112:

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

input:

9997
aaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaaaaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaaba...

output:

70056900

result:

ok 1 number(s): "70056900"

Test #113:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

899
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

808201

result:

ok 1 number(s): "808201"

Test #114:

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

input:

9997
aaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaaaaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaa...

output:

77316849

result:

ok 1 number(s): "77316849"

Test #115:

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

input:

9997
abacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacaba...

output:

34012224

result:

ok 1 number(s): "34012224"

Test #116:

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

input:

9998
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

99960004

result:

ok 1 number(s): "99960004"

Test #117:

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

input:

9998
baabbabbbbbabbaabababaaababababbaabbaaaabaabaabababbbbabbbabaabbbbabaababaaabaabababaabaabbbbaabbaabbabaaabaabbbabbbabaabaaaababaabbaaaababbbaababbabaabbaabbbbaabbbabbababbaabbaaaabbbaaaababbabbbbbbbbbaabbbbbaaabbbabaaaaaabaabaabbaaaaababbbabbaaabaababaaabaaaabaabaaababbbaaaaaaabbaaaababbaabaaa...

output:

25240576

result:

ok 1 number(s): "25240576"

Test #118:

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

input:

9998
bcbcbcacabaabbbcccabacaaccacaaabaaaccaabcacbbcbbcbbacbbbaaaaccbbcbabcabcacaccacacbcbbccbbccbaccbabbaabccacbbaabacabcbbacbcbcbbaaaaacabacbccacbbbaaaabcabbcaaacaccaabcbbbccbcccbbabacaabaccbbbcbcaccacbbbcbaacccbccbcccabaaaacaacccacccacbcacaabcaacbbabaaaaaaabaabaacbabbbbcbacabacaabaaccbaabcaaacabcc...

output:

11142244

result:

ok 1 number(s): "11142244"

Test #119:

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

input:

9998
abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaa...

output:

24990001

result:

ok 1 number(s): "24990001"

Test #120:

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

input:

9998
abcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcacababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacaba...

output:

11108889

result:

ok 1 number(s): "11108889"

Test #121:

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

input:

9998
acaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacac...

output:

38180041

result:

ok 1 number(s): "38180041"

Test #122:

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

input:

9998
abaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaaba...

output:

41306329

result:

ok 1 number(s): "41306329"

Test #123:

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

input:

9998
abaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaa...

output:

44422225

result:

ok 1 number(s): "44422225"

Test #124:

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

input:

9998
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcb...

output:

49980002

result:

ok 1 number(s): "49980002"

Test #125:

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

input:

9998
aaccbbcababaaabacbbcacbbbbaaaaaaaaacabcccbbbbcaaacbbbaaaaaabbcaacacacacabaabacacaacbacbbbaaacaabbcabaabaabbcbaaaaabcbbaacabacbaaaccbaacacaabaaacbbacbbaaaaabcaccaabaaaaaabbbacacbacabcccaacacbcbabaaaaaabbacbbbbaacacabcaaababbbabaaaaacbababbbaabaabbccaaacbacbaaabcbcaccbcbabaacccbcabaaabcaabcaacaac...

output:

24730729

result:

ok 1 number(s): "24730729"

Test #126:

score: 0
Accepted
time: 4ms
memory: 3736kb

input:

9998
bacbbccbccbcaacccccbccacacacaccccbcaccaacccbcccbccabacccccccbcccccbbbcccbccccccabcbccccccacaccccbcccccccbbabbbabcbcccccaccbcbccbccccccbabbbabccabccccacccacbcbbccaccccbcbbccccccccbbccbcabcaabcacbabcccccacacbccabcccaacccbccbccbbcacbcbccbccbbbabccbcccbacccccccccccabbcbacacbcbccccaccccbccccacbcbbbc...

output:

43877376

result:

ok 1 number(s): "43877376"

Test #127:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

9998
bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

49980002

result:

ok 1 number(s): "49980002"

Test #128:

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

input:

9998
babcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbab...

output:

24990001

result:

ok 1 number(s): "24990001"

Test #129:

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

input:

9998
aaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaabaaabaaabaaabaaacaaabaaabaaabaaacaaabaaa...

output:

58033924

result:

ok 1 number(s): "58033924"

Test #130:

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

input:

9998
ababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababaca...

output:

28440889

result:

ok 1 number(s): "28440889"

Test #131:

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

input:

9998
aaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaaaaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaaba...

output:

70073641

result:

ok 1 number(s): "70073641"

Test #132:

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

input:

899
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

808201

result:

ok 1 number(s): "808201"

Test #133:

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

input:

9998
aaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaaaaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaa...

output:

77334436

result:

ok 1 number(s): "77334436"

Test #134:

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

input:

9998
abacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacaba...

output:

34012224

result:

ok 1 number(s): "34012224"

Test #135:

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

input:

9999
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

99980001

result:

ok 1 number(s): "99980001"

Test #136:

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

input:

9999
abababbabbaaaaaabaaabaabaabbbabbbbbbaabaabbbbbababaaabababbabbaababbabaabaaabaaaabbababbbbabaabbbaaaaaaaaaaabbabbbaaabaabbabbaabbabaababaaabbbbbbbababbbabbbababaabbbbaaaaabbaababaaabaabbabababaabaabbbababaabbabbbababbaabbbabbbbbbbbabbaabbaaaaababaabbaababbbabbbaaaaabaabaabbaabaaaaababbbaabbbaaa...

output:

25959025

result:

ok 1 number(s): "25959025"

Test #137:

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

input:

9999
babababacccabaababcabbcaabccacaacbcabbccbbcbabacbaaacbcabbcabaaaabbcaabbcacaaaaabacaabbcaacbbcabccccbabcbababacabaacbacabaaabbbababaabcbbccbcbaabaccccbbbbacbcbacaccbccaabcccbabbcaccaabaacaabcabbcaaccbabccaacaabacabcbcabbabcaaacccabbaacbbbcabccccacbabbccbcbbbcbbaabaaaacaababcacacccbcbaacbbaccabb...

output:

11682724

result:

ok 1 number(s): "11682724"

Test #138:

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

input:

9999
abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaa...

output:

25000000

result:

ok 1 number(s): "25000000"

Test #139:

score: 0
Accepted
time: 4ms
memory: 3908kb

input:

9999
abcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcacababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacaba...

output:

11108889

result:

ok 1 number(s): "11108889"

Test #140:

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

input:

9999
acaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacacaacaacacaacacaacaacacaacacaacaacac...

output:

38192400

result:

ok 1 number(s): "38192400"

Test #141:

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

input:

9999
abaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaaba...

output:

41319184

result:

ok 1 number(s): "41319184"

Test #142:

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

input:

9999
abaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaa...

output:

44435556

result:

ok 1 number(s): "44435556"

Test #143:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

9999
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcb...

output:

49980002

result:

ok 1 number(s): "49980002"

Test #144:

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

input:

9999
bbccbbabbbbcabbbaabbbbbcbbbbbababacabaaababbbbabbabbbcccbbbbbccbbaabcbabbbbabbbacaaccabcbcababccaaaabcabcbbbaabbbbbabacacabbacbaccacbaabbbaabacbbaacaaabbcbbcbbccbcbbbbbbccbbaccbbcbacbabcbacbbccbbbabaaccacbacacbbbbbbccaccaabbacabaabbcacabbbaabbacabccbabccbccacbcbbcababbbcaabcccbccbbbbbbabbcbacbc...

output:

24730729

result:

ok 1 number(s): "24730729"

Test #145:

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

input:

9999
bbbbbbbaaaabaabbacbbabbbbcbbbbbbbbbaccbbbbbbbaabbbbacabbbbbabbabcabcbbbbbabbbabbbbbbabbbbabcbbbbbbacbbbbabbababbbcbbbabcabbcbbabbbbbbbcbcacbbcbbacbbbcbbbcbbcabbabbabcbbbbbbbbbbaabbbaabbbaaababbbbbacbbabaababbbbbbbbcaabbbbbbabbbacbbbabbbcbbbababbcbbaabccaabbcbbbababaabbbbbabbbbbbbabbbbbbbabbbaba...

output:

44368921

result:

ok 1 number(s): "44368921"

Test #146:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

9999
cbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbc...

output:

49980002

result:

ok 1 number(s): "49980002"

Test #147:

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

input:

9999
acabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabaca...

output:

25000000

result:

ok 1 number(s): "25000000"

Test #148:

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

input:

9999
aaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaabaaabaaabaaabaaacaaabaaabaaabaaacaaabaaa...

output:

58049161

result:

ok 1 number(s): "58049161"

Test #149:

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

input:

9999
ababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababaca...

output:

28451556

result:

ok 1 number(s): "28451556"

Test #150:

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

input:

9999
aaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaaaaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaaba...

output:

70090384

result:

ok 1 number(s): "70090384"

Test #151:

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

input:

899
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

808201

result:

ok 1 number(s): "808201"

Test #152:

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

input:

9999
aaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaaaaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaa...

output:

77352025

result:

ok 1 number(s): "77352025"

Test #153:

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

input:

9999
abacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacaba...

output:

34023889

result:

ok 1 number(s): "34023889"

Test #154:

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

input:

10000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100000000

result:

ok 1 number(s): "100000000"

Test #155:

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

input:

10000
babaaaaabaabbabbaaaabbbbbaaabaaaabbabbbbaabbbaababbaaaaabbbaaabbbbbabaabbabbbabaabaabbababaabbaaaabbbaaabbbbababaaababbaaababaabbaabbbabbababbbabaabbbabbbabbaaabababbabbbbbbababaaaabbabaaababbaaabaaaabaaababbabaaabbaabbabbabbabababaabbbabbbbbabaaaaababababbbbaabaabbabababbabbabbaabababbabababa...

output:

25938649

result:

ok 1 number(s): "25938649"

Test #156:

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

input:

10000
caabbabacaccccacaaaabaccabcbcbcacacaaabaaacccbabacbacbbacabbbbabbcbbccbbcbaccaccccacaacacbcccccbccaacabbbcaaabacbbaabacbabccbbccccabacbcbbaaabbbaabcbbcccbbcbcccbcaacbababcbbcacbaaacbbccbcbbcccabaabbacbbccaaccbbabcabaacbbcccacccbccbabaaaaaccccacccacccccbaaccbcbbcaaabababcbaaabcccbccaacacaaaabca...

output:

11195716

result:

ok 1 number(s): "11195716"

Test #157:

score: 0
Accepted
time: 1ms
memory: 3680kb

input:

10000
abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbaba...

output:

25000000

result:

ok 1 number(s): "25000000"

Test #158:

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

input:

10000
abcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcacababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacab...

output:

11115556

result:

ok 1 number(s): "11115556"

Test #159:

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

input:

10000
caccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccacaccaccacaccacaccaccacaccacaccaccac...

output:

38192400

result:

ok 1 number(s): "38192400"

Test #160:

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

input:

10000
abaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaab...

output:

41332041

result:

ok 1 number(s): "41332041"

Test #161:

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

input:

10000
abaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaaba...

output:

44448889

result:

ok 1 number(s): "44448889"

Test #162:

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

input:

10000
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbc...

output:

50000000

result:

ok 1 number(s): "50000000"

Test #163:

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

input:

10000
bacbbbbacababacbcabbbcbcacbbbbaaaabcccbbbaababbaabaacaaccbcbababbabbabbaaaabbcabbbbabcccaacbaacbbabaabccbbbaabcbbbababccbbbaacababbabbbabbbbbabbabbbcbbbbabbbbabbbbabbaccbbcbbbbbbabcbbbcbacbbbbcababbcbbcbabbbababbbacccbcbabbabcbbaacaabccbabbbbbcbbcbabcbccbbcbbcbabcabcbbbacbaccbbabbcabacabbababb...

output:

24920064

result:

ok 1 number(s): "24920064"

Test #164:

score: 0
Accepted
time: 4ms
memory: 3692kb

input:

10000
ccaacccaccccbcaaccacaccccccbcccaabbccacccacccbcbbcaccbbabcbaccacccacbccbbcabccbacccaaabccccacccacabaacbaccccccccaccccaccbccbbcccccccaaaccccaccccacbaaccccccccaccacbccaabcccbcccccccccccccccccccccbccbccccaabbaccccccccacccbccacccaccccccbcacacccbbccccacccabccaccacacccacccacccccbccacccacbaccaccccccc...

output:

45131524

result:

ok 1 number(s): "45131524"

Test #165:

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

input:

10000
ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

50000000

result:

ok 1 number(s): "50000000"

Test #166:

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

input:

10000
cbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacbcacb...

output:

25000000

result:

ok 1 number(s): "25000000"

Test #167:

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

input:

10000
aaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaaaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaabaaabaaabaaabaaacaaabaaabaaabaaacaaabaa...

output:

58049161

result:

ok 1 number(s): "58049161"

Test #168:

score: 0
Accepted
time: 4ms
memory: 3908kb

input:

10000
ababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacababaaababacababacababacabababababacababacababacababaaababacababacababacababaaababac...

output:

28451556

result:

ok 1 number(s): "28451556"

Test #169:

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

input:

10000
aaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaaaaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaab...

output:

70107129

result:

ok 1 number(s): "70107129"

Test #170:

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

input:

899
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

808201

result:

ok 1 number(s): "808201"

Test #171:

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

input:

10000
aaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaaaaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaa...

output:

77352025

result:

ok 1 number(s): "77352025"

Test #172:

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

input:

10000
abacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacabacabaaabacab...

output:

34023889

result:

ok 1 number(s): "34023889"