QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#72337#5037. 回文zhoukangyang60 4029ms51420kbC++175.3kb2023-01-15 14:45:382023-01-15 14:51:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-15 14:51:28]
  • 评测
  • 测评结果:60
  • 用时:4029ms
  • 内存:51420kb
  • [2023-01-15 14:45:38]
  • 提交

answer

#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); i++)
#define R(i, j, k) for(int i = (j); i >= (k); i--)
#define ll long long
#define ull unsigned long long 
#define sz(a) ((int) a.size())
#define vi vector<int>
#define me(a, x) memset(a, x, sizeof(a))
#define uint unsigned int 
using namespace std;
const int N = 4e5 + 7, B = 37;

struct segmenttree {
	
}; 

int n, q;
char s[N];
namespace gao { // i use luan gao 

char t[N];
uint hs[20][N], ht[20][N], pw[N];
void changes(int x, char c) {
	uint dec = c - s[x], cur = dec;
	s[x] = c;
	for(int d = 0; d <= 17; d += 2) {
		dec = cur;
		int kd = 1 << d;
		
		int wl = max(x - kd + 1, 1), wr = min(x, n - kd + 1);
		dec *= pw[x - wr];
		if(wr >= wl) { 
			for(auto u = hs[d] + wr; u != hs[d] + wl - 1; --u) *u += dec, dec *= B;
		}
	}
}
void changet(int x, char c) {
	uint dec = c - t[x], cur = dec;
	t[x] = c;
	for(int d = 0; d <= 17; d += 2) {
		int kd = 1 << d;
		dec = cur;
		
		int wl = max(x - kd + 1, 1), wr = min(x, n - kd + 1);
		dec *= pw[x - wr];
		if(wr >= wl) 
			for(auto u = ht[d] + wr; u != ht[d] + wl - 1; --u) *u += dec, dec *= B;
	}
}
void inits() {
	L(i, 1, n) hs[0][i] = s[i];
	L(i, 1, 17) 
		L(j, 1, n - (1 << i) + 1) 
			hs[i][j] = hs[i - 1][j] + hs[i - 1][j + (1 << (i - 1))] * pw[1 << (i - 1)];
	
}
void initt() {
	L(i, 1, n) ht[0][i] = t[i];
	L(i, 1, 17) 
		L(j, 1, n - (1 << i) + 1) 
			ht[i][j] = ht[i - 1][j] + ht[i - 1][j + (1 << (i - 1))] * pw[1 << (i - 1)];
}

int lg[N];
int main() {
	pw[0] = 1;
	L(i, 1, n) pw[i] = pw[i - 1] * B;
	L(i, 1, n) t[i] = s[n - i + 1];
	L(i, 2, n) lg[i] = lg[i >> 1] + 1;
	inits();
	initt();
	int lst = 0;
	while(q--) {
		int op;
		cin >> op ;
		if(op == 1) {
			int i;
			string sss;
			cin >> i >> sss;
			i ^= lst;
			assert(1 <= i && i <= n);
			char c = sss[0];
			changes(i, c);
			changet(n - i + 1, c);
		} else {
			int l, r;
			cin >> l >> r;
			l ^= lst, r ^= lst;
			assert(1 <= l && l <= r && r <= n);
			
			int xlen = r - l + 1;
			int ns = 0;
			
			l = n - r + 1; 
			L(d, 0, lg[xlen]) {
				int wl = (1 << d), wr = min(xlen, (1 << (d + 1)) - 1);
				int pr = r - (1 << d) + 1;
				int l1 = l, l2 = l, r1 = pr, r2 = pr;
				int lp = -1;
				if(!(d & 1)) {
					r1 -= wr - wl;
					l2 += wr - wl;
					R(len, wr, wl) {
						if(ht[d][l1] == hs[d][r1] && ht[d][l2] == hs[d][r2]) {
							++ns;
							if(lp == -1) {
								lp = len;
							} else {
								ns += (len - wl) / (lp - len);
								break;
							}
						}
						++r1, --l2;
					}
				} else {
					r1 -= wr - wl;
					l2 += wr - wl;
					int OP = (1 << (d - 1));
					R(len, wr, wl) {
						if(ht[d - 1][l1] == hs[d - 1][r1] && 
							ht[d - 1][l1 + OP] == hs[d - 1][r1 + OP] && 
							ht[d - 1][l2] == hs[d - 1][r2] && 
							ht[d - 1][l2 + OP] == hs[d - 1][r2 + OP]) {
								++ns;
								if(lp == -1) {
									lp = len;
								} else {
									ns += (len - wl) / (lp - len);
									break;
								}
							}
						++r1, --l2;
					}
				}
			}
			cout << ns << '\n';
			lst = ns;
		}
	}
	return 0;
} 


}

int ch[N][26], cov[N], dep[N], f[N], len[N], p;
int getfa(int x) {
	for(; p < len[x] + 1 || s[p - len[x] - 1] != s[p]; x = f[x]) ;
	return x;
}
int lst, tot = 1; 
void ins() {
	lst = getfa(lst);
	if(!ch[lst][s[p] - 'a']) 
		++tot, f[tot] = ch[getfa(f[lst])][s[p] - 'a'], ch[lst][s[p] - 'a'] = tot, len[tot] = len[lst] + 2,
		dep[tot] = dep[f[tot]] + 1;
	lst = ch[lst][s[p] - 'a'];
}
int Pos[N], jp[20][N];

char t[N]; 
uint hs[20][N], ht[20][N];
uint ps[N], pt[N], pw[N];
void changes(int x, char c) {
	s[x] = c;
}
int lg[N];
uint S[N];
int main() {
//	return system("fc ovo.out qwq.out"), 0;
//	freopen("data.in", "r", stdin);
//	freopen("ovo.out", "w", stdout);
	ios :: sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	f[0] = 1, len[1] = -1;
	cin >> (s + 1);
	n = strlen(s + 1);
	cin >> q;
	
	if(n <= 2e5 && q <= 5e4) {
		gao :: main();
		return 0;
	}
	
	pw[0] = 1;
	L(i, 1, n) 
		pw[i] = pw[i - 1] * B;
	L(i, 1, n) {
		S[i] = s[i] - 'a' + 1;
		p = i;
		ins();
		Pos[i] = lst; 
	}
	
	L(i, 2, n) 
		lg[i] = lg[i >> 1] + 1;
	
	L(i, 1, tot) 
		jp[0][i] = f[i];
	L(o, 1, 19)
		L(i, 1, tot) {
			jp[o][i] = jp[o - 1][jp[o - 1][i]];
		}
	
	int k = 5e3;
	if(n > 5e3) {
		k = 100;
	}
	int lst = 0;
	bool ok = true;
	while(q--) {
		int op;
		cin >> op ;
		if(op == 1) {
			int i;
			string sss;
			cin >> i >> sss;
			i ^= lst;
			char c = sss[0];
			s[i] = c;
			S[i] = c - 'a' + 1;
			ok = false;
		} else {
			int l, r;
			cin >> l >> r;
			l ^= lst, r ^= lst;
			
			if(ok) {
				int ns = 0;
				
				int cur = Pos[r];
				R(o, 18, 0) 
					if(len[jp[o][cur]] > r - l + 1) 
						cur = jp[o][cur];
				
				if(len[cur] > r - l + 1) 
					cur = f[cur];
				
				R(o, 18, 0) 
					if(jp[o][cur] > 1) 
						cur = jp[o][cur], ns += 1 << o;
				while(cur > 1) 
					ns += 1, cur = f[cur];
				
				cout << ns << '\n'; 
				lst = ns;
				
				continue;
			}
			
			int ns = 0;
			unsigned long long a = 0, b = 0, pw = 1;
			auto u = S + r;
			
			int len = min(r - l + 1, k);
			L(i, 1, len) {
				a = a * B + *u, b += pw * *u, pw *= B, ns += a == b, --u;
			}
			cout << ns << '\n';
			lst = ns;
		}
	}
	return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 6ms
memory: 12072kb

input:

aabbbabbbaaaaaaabbabbbaaaabaaaabbaabbaabbaaababbbabbbbabbbbaaaabbbabbbbbaaabbbabbaaaaabbbbbaaababbabbaaaaabaabbbbaaababaaabbaabbabbbabbbbaaaaabbbbbbbabbbaabbbabbabbbababbabbbbaaaaabbaababbbbaabbaaaaaabaaabbbaaababbbbaabaaaaababababbbbbbaaaabbbbaaababaaabbaabbbbbaaaabbaaaabaaaaaababbababaaaabaaababaa...

output:

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

result:

ok 2509 tokens

Test #2:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

188
1078
673
914
360
4255
2205
3628
77
3608
230
494
128
848
801
1335
4079
3059
636
2882
3524
45
1174
506
3570
4172
1289
595
3829
1532
179
1274
2574
1098
2817
226
2580
887
989
1829
3656
181
2056
3315
786
117
2519
2742
3787
1080
3138
686
1605
239
1533
2658
2096
753
3400
219
1815
117
1645
52
1671
121
2...

result:

ok 2519 tokens

Test #3:

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

input:

bbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbbbbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbbbbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbbbbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbba...

output:

12
8
12
24
30
18
11
8
32
18
10
32
26
11
11
15
18
6
18
19
13
21
10
13
20
16
10
10
10
9
16
11
32
14
24
20
29
15
10
17
10
8
8
22
31
9
9
18
25
10
14
16
22
24
15
15
11
13
33
7
13
21
7
19
12
12
17
7
23
15
2
10
16
15
9
14
6
18
10
8
18
20
21
5
11
18
3
17
13
17
8
11
17
7
6
7
11
10
9
20
9
28
19
10
14
11
24
8
...

result:

ok 5000 tokens

Test #4:

score: 0
Accepted
time: 9ms
memory: 10072kb

input:

mkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmumkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmkmkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmumkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmpmkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkma...

output:

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

result:

ok 5000 tokens

Test #5:

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

input:

babababababababababababababababababababababababababababababababbbabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababbbabababababababababababababababababababababababababababababababbbabababababababababababababababababababababa...

output:

58
13
6
23
52
35
39
46
17
43
37
33
31
8
51
12
9
52
57
14
28
17
31
21
59
50
55
50
18
10
54
7
44
11
10
3
12
19
9
8
5
7
22
4
38
15
10
14
26
11
21
18
33
12
3
8
23
34
41
18
7
18
26
7
12
29
34
6
4
15
16
20
15
8
50
23
7
51
18
4
11
7
20
14
33
19
12
9
10
6
8
21
28
22
21
18
12
18
4
15
17
13
8
16
7
14
10
4
5
3...

result:

ok 2443 tokens

Test #6:

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

input:

aaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaa...

output:

43
25
18
13
12
27
16
18
22
24
13
20
34
18
5
27
26
27
8
10
6
9
9
14
22
15
34
25
19
24
19
18
13
7
21
14
2
33
7
46
16
18
19
12
25
8
7
14
22
2
2
12
19
3
20
15
18
10
8
8
8
12
5
12
18
22
7
15
16
36
21
11
11
14
8
13
12
2
5
40
14
15
2
5
11
4
12
16
11
9
9
6
6
18
16
11
15
18
13
15
8
24
19
9
5
15
18
8
13
5
31
...

result:

ok 2498 tokens

Test #7:

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

input:

baabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabcaaaaaaaacbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabba...

output:

67
7
4
13
81
3
8
92
28
86
94
92
71
23
73
26
24
13
71
88
98
42
70
45
82
63
5
80
57
49
48
77
88
5
98
96
65
52
11
24
52
51
76
90
9
10
58
43
36
48
82
73
10
14
90
54
74
12
32
36
71
46
8
46
20
38
22
68
54
73
66
32
95
63
52
7
40
97
27
13
42
59
41
14
9
44
53
52
92
30
36
27
86
90
59
95
12
36
42
16
24
58
23
5...

result:

ok 5000 tokens

Test #8:

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

input:

caaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaac...

output:

10
10
11
11
11
10
10
10
8
10
11
11
9
9
10
10
10
11
10
11
9
10
10
11
11
11
10
11
11
11
11
11
11
11
11
10
10
10
10
11
11
11
10
11
10
10
10
11
10
10
10
10
10
11
11
11
11
10
11
11
11
10
11
11
11
10
10
7
11
11
10
11
10
10
11
10
11
10
10
7
11
11
10
10
11
11
10
10
2
11
11
11
5
11
11
11
11
11
10
10
10
11
11...

result:

ok 1667 tokens

Test #9:

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

input:

cabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbb...

output:

38
38
38
37
38
38
38
9
37
38
8
38
37
38
38
38
38
38
38
37
27
38
38
38
38
38
38
30
38
38
38
38
38
38
38
38
24
38
38
38
38
38
38
38
38
38
37
38
5
38
32
25
38
38
38
38
38
38
38
38
38
38
38
37
38
37
38
31
38
38
38
38
38
38
12
38
38
37
38
38
38
38
37
38
38
38
23
38
38
38
38
24
38
38
38
38
38
35
38
38
38
...

result:

ok 1667 tokens

Test #10:

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

input:

baaabbbaaabbbbaaababbababbabbbbaaaababaababbbbababababbbaabbbaababaaaababbbaaabaaababbababaaabbabbbaaabbabbbabaabaaaababbbbabbbbbaabbabbaaaabaaabababbbaababbbaaaaaababbabaaabaaaabbbabbbaababbbbbbbbaabbbaabbabaabababbaabaabaabbbbbaaababbbbabbbababababaabbababaabbabbbbbbaaaaaaabaabbabbabaabbbbbaaaaaba...

output:

3
3
2
3

result:

ok 4 tokens

Test #11:

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

input:

abbaaabaabbbaabbabbbbbbaabbbbabbaabababaabbabbabaaabbabbbaaaabbabbaabbbabbbabbababaaaabbabbaabababbbaaababaababbabbaaabbbaabaaaaaabbbabbababaabbbbbabbbaaaaaaabbaaaabaaababbababaabaaabbbaaabbaabbabbabbbababbabbbbbbbbaabbabbbabbbbbbbababaabbbaabaabaabaaabababbaabbbbaaabbbbabbaabbbabbbababaababbabbabba...

output:

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

result:

ok 4997 tokens

Test #12:

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

input:

lxxhwqorbxrdzedxlvymggyicczuafgyovixrzmptqfmjyjfpamcsehmfazbvfwdgeftgbtyurnnykwjhzfqqsyiyzkpwlmspjsxdkjtpgzbrvwwcjqejmuillhgtbhwtwmvhacfphrcgwoaihjzkuccmwuidivmpjcezbjywhbqtdgrhlrskcwmecflzpjbuutlocivcfvbcdvlnfchtvvcpoubnjwfwvzvpyvhkvxdmleyvucrondntpaonjybzarkgjnkuuvipkqgvwzzzopwyfnmodnmdziueescfttr...

output:

1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 2493 tokens

Test #13:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

849
1135
1444
1346
1445
536
3077
2631
1447
672
2214
2149
2090
4054
846
559
22
92
4224
161
2280
572
2347
2599
778
4093
750
3647
2142
642
474
1395
776
645
46
4141
2272
771
1564
207
4284
2896
3097
2829
306
1383
394
1776
1284
3933
102
510
1101
3639
1336
1292
2803
1159
601
1464
2585
673
281
1340
272
3310...

result:

ok 2478 tokens

Test #14:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
...

result:

ok 4999 tokens

Subtask #2:

score: 10
Accepted

Test #15:

score: 10
Accepted
time: 346ms
memory: 45844kb

input:

aabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaabbbaaabbaabbbbaabbaaabbbaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaabbaaabaaaaaabaaabbaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabb...

output:

41
43
154
118
55
165
48
163
119
207
147
145
33
67
114
124
154
9
104
307
102
73
39
364
79
177
53
39
88
264
77
114
79
195
150
153
157
46
129
136
147
25
309
11
12
258
259
133
355
50
116
336
13
127
18
34
122
161
38
99
290
92
355
166
59
152
41
182
103
282
166
23
86
173
32
122
60
127
287
20
83
214
119
144...

result:

ok 200000 tokens

Test #16:

score: 0
Accepted
time: 367ms
memory: 48096kb

input:

beebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebccbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeeb...

output:

38
55
18
35
62
44
48
20
70
35
36
42
40
11
14
13
67
54
61
70
51
27
62
18
39
52
53
53
34
57
53
46
28
22
15
64
32
44
11
11
57
35
21
45
32
39
42
27
31
51
28
31
18
12
25
41
55
37
42
17
38
33
21
29
54
15
43
24
17
42
63
19
32
49
17
21
50
62
52
56
49
56
18
24
17
22
26
18
60
31
24
59
58
69
18
16
38
39
54
48
...

result:

ok 200000 tokens

Test #17:

score: 0
Accepted
time: 412ms
memory: 50860kb

input:

cgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagcaidiaaidiacgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccg...

output:

17
15
19
21
17
18
21
12
12
15
18
20
14
14
16
20
15
19
11
17
10
20
16
16
16
19
12
17
16
15
18
12
24
20
12
19
9
17
13
21
28
10
13
17
10
14
13
24
17
17
19
24
11
18
16
14
13
13
17
13
22
21
20
14
7
11
18
15
18
12
12
12
19
14
15
16
19
20
16
23
19
16
18
13
24
22
17
13
15
21
21
22
13
21
19
20
9
20
14
14
15
...

result:

ok 200000 tokens

Test #18:

score: 0
Accepted
time: 283ms
memory: 49912kb

input:

rprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprwrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprvrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprwrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprbrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprx...

output:

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

result:

ok 200000 tokens

Test #19:

score: 0
Accepted
time: 89ms
memory: 51140kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998...

result:

ok 200000 tokens

Test #20:

score: 0
Accepted
time: 70ms
memory: 51420kb

input:

susjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusnsusjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusysusjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusnsusjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusisusjsusosusjsusgsusjsusosusjsusmsusjsusosusj...

output:

11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
...

result:

ok 200000 tokens

Subtask #3:

score: 10
Accepted

Test #21:

score: 10
Accepted
time: 32ms
memory: 12524kb

input:

abbaaaabbabaaaaaabaabbaabbababbaaabbabbbabaabaabaaaaabaabbbbabbabbabbbababbbababababbbbabaabbaaababbbbbababbbbaabbbaaabaababababaabbbbbbaababaabbaaabaabbaaababbabbabbbbaaaaabaaabbbabbbbbbabbbabbabaabbbbbbbaaaabbaaaababbbaaaaaaababaabbbbaaabaaabbaabbbbbbababbaabbaaabbabbbbbabaababbaabaaaabbbbabababba...

output:

2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
8
8
8
8
...

result:

ok 198 tokens

Test #22:

score: 0
Accepted
time: 64ms
memory: 10656kb

input:

abbaababbabababbbbabababbbaaaabababbbbaabaabbbbabbbabbaabababbbabaaabbabbaabbbbbbaaababaababbbaabbbbaabbbaaaaaabaabbaabbaaaabaaabbaabbbaabbbababbbabbaaababaabaaabaabbabababaaaabaabbbbaaabbbbbbabbbbababbaabaabbbbabbaaabbaabaabbaabaabaaaaaabbaaabbbbbabbbbbaaabbabbabbaababaaabbabbaaaaaabbababbbaabbaabb...

output:

2
6
2
2
3
2
2
3
4
3
4
3
2
8
2
3
2
4
4
4
3
2
4
3
4
4
2
3
3
3
3
2
13
4
2
5
5
3
3
2
2
4
2
3
3
4
3
2
2
3
3
2
2
6
3
4
3
3
2
2
2
3
2
3
3
4
3
2
2
3
2
4
3
5
5
3
3
2
2
3
3
2
3
4
5
2
2
3
2
5
3
2
5
3
5
3
3
2
5
3
3
4
4
2
2
3
4
2
2
2
2
3
3
2
2
5
3
2
3
3
4
2
6
3
2
13
2
2
2
3
2
2
4
2
3
2
3
3
4
4
5
4
3
2
12
2
2
3
2...

result:

ok 199806 tokens

Test #23:

score: 0
Accepted
time: 74ms
memory: 7284kb

input:

bbabbbaaaaabbbbabaabbaabbaabbbaabbabaaabaaabbbbabbbabaabbbbbbbabbbaabbbabbabaabababaaababaabaaabaabbbabbbbbabbbbbbbbbbbaaabaaaaabaaaaababbaaaaabbabaaabbabaabababaabbbabbbbaabaabbaaabaabbaabbbbbababbabaabbbbaaabaaaababbabbaaaabbabaabbabbbbbababbabbbaaabababbababbbaabbbbabbbbaaabbabbaaabbaaababbabaaab...

output:

2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 199800 tokens

Test #24:

score: 0
Accepted
time: 69ms
memory: 7268kb

input:

bababaaaaabbabbbbababbbbbbababbbbbaaaabbabbbbabaaababbababbaaabbabababbabbaabbabbbaababbbabaaaabbabbababbabbbabababbabbaabbbaabaabaabbbaabbabbabbababbabbaaabbbabababababaababaababbbaaababbbaababbbbabaaabaaabbababaaabbbbbaabababbbbbaabaaaaababaaabaababbaaababbbbabbbbbaababbababbbbabaabbabbbabaaaabbbb...

output:

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

result:

ok 199800 tokens

Test #25:

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

input:

aaabaaababbbabaaaababbbaabaaaabababaaabbaaaabbbbbabbaabbbbbbabbabbbaabaaaabbbabbbbbbbbaabbaaaaaabbabbaabbaaaaaabaaaabbbbbbaabbaabaaabbbaaaaaaabbbabaaaaabbbabbbaaabaaaabababaaaaaaabaaabaababbbbabbbabbbaabbbbaaaabbbbaababaababaaabbaabbbaabbabaabaaabbabaaababbaaaaabaaaabbbbabaaabbbaaaaabababbabaabbabab...

output:

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

result:

ok 211 tokens

Test #26:

score: 0
Accepted
time: 74ms
memory: 7312kb

input:

ababaaabaabbbaabbaabaaaabaaabaabbababbababaabbaabbbbaaabaabaabaaaabaababbbaabbabbaaabaabbaabababbbababbabaaaabbabbbbbbaabababbbbababbaaabaaababbbbaabbaaaabbbbaaabbbabbabbaabbbbababbaabaabbabbababbabbaababbbaaaaababbaabbbbabaabbbabbbbbaaababbaaabbbbaaababbaababaaabaaabaababbabaabaabbbbaaaaabbababaaab...

output:

3
2
2
3
3
5
3
4
3
3
2
3
4
2
3
4
3
3
3
2
3
4
2
4
2
3
2
2
2
3
3
4
3
2
3
3
4
4
3
2
3
3
3
2
3
2
3
3
5
2
2
2
4
3
3
2
2
2
5
4
3
7
2
3
2
5
3
2
3
3
3
3
3
2
2
4
3
3
2
2
2
2
3
2
7
3
2
3
3
2
2
3
2
2
3
3
4
3
4
3
4
3
2
2
3
3
3
4
3
5
5
2
2
3
4
5
3
3
5
3
2
2
3
2
8
3
5
5
3
3
2
3
4
2
2
4
2
2
2
2
2
4
4
3
4
3
3
2
3
2
...

result:

ok 199782 tokens

Subtask #4:

score: 0
Wrong Answer

Test #27:

score: 10
Accepted
time: 55ms
memory: 7244kb

input:

babbaaabbbbbbbabbbababaabbbbbababababbaabaabbbbbbabbbbbbbbbbababbbbabbaabbbaabaabbabbbaabbabbbabbababaababbbabbbbaabbabbabbaaaabbbaaabbbbaabbaaaaaaabbbabbbaaabaababaaabaaaabaaaababaaaaababaaaabaabbaaaabbbabbaabaabbbabbbbbaaabaababbbaaaaabbbbaaabbbbaabbabbbbabbbabbaaaaabaabaaaabbbabbbbbaabbbbabbbbaab...

output:

4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
...

result:

ok 100490 tokens

Test #28:

score: -10
Wrong Answer
time: 37ms
memory: 45024kb

input:

lqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqllqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqlfibyjjybiflqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqllqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqlewwelqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqllqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvd...

output:

3
2
88
100
100
100
100
100
100
36
3
3
100
3
4
3
4
3
4
3
3
3
3
3
5
3
3
100
1
3
3
3
53
20
53
20
53
100
72
93
3
34
3
34
3
34
3
3
3
3
3
3
3
58
3
58
3
30
3
30
3
30
3
3
10
3
10
3
10
3
10
100
100
100
100
71
100
71
100
100
94
100
55
3
2
3
3
3
3
3
3
3
3
3
100
50
3
3
3
3
2
53
2
53
2
53
2
53
2
53
2
2
3
60
3
60...

result:

wrong answer 1st words differ - expected: '487', found: '3'

Subtask #5:

score: 30
Accepted

Dependency #1:

100%
Accepted

Test #35:

score: 30
Accepted
time: 2095ms
memory: 34588kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

199105
199317
198628
198977
198643
198338
198952
198567
198980
198350
199045
199831
199124
199126
199123
199367
198992
198131
198623
199391
199376
199431
198418
198674
199222
199031
198833
198400
199208
198925
198477
198700
198952
199129
199580
199549
198972
199285
199185
198739
199281
199208
198920...

result:

ok 24945 tokens

Test #36:

score: 0
Accepted
time: 3766ms
memory: 37688kb

input:

abbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaab...

output:

48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
...

result:

ok 50000 tokens

Test #37:

score: 0
Accepted
time: 2822ms
memory: 35380kb

input:

bbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbabbbaabbaabbbabbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbabbbaabbaabbb...

output:

1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
...

result:

ok 49950 tokens

Test #38:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998...

result:

ok 49947 tokens

Test #39:

score: 0
Accepted
time: 3530ms
memory: 34360kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

200000
200000
38385
38385
33776
33776
4138
200000
200000
200000
200000
78010
200000
200000
125726
125726
125726
125726
125726
125726
125726
125726
68615
68615
68615
40794
40794
40793
40793
199213
199213
194729
185537
185537
64215
64215
64215
64215
21860
21861
21861
21861
21861
21861
200000
192672
13...

result:

ok 16668 tokens

Test #40:

score: 0
Accepted
time: 3778ms
memory: 33552kb

input:

bbabbaabbabbbbabbaabbabbabbabbabbaabbabbbbabbaabbabbbbabbaabbabbbbabbaabbabbabbabbabbaabbabbbbabbaabbabbbbabbaabbabbbbabbaabbabbabbabbabbaabbabbbbabbaabbabbbbabbaabbabbbbabbaabbabbabbabbabbaabbabbbbabbaabbabbbaaabbbbbbbbbbbbbbbbaaabbbabbaabbabbbbabbaabbabbabbabbabbaabbabbbbabbaabbabbbbabbaabbabbbbab...

output:

49
49
49
49
42
42
42
42
42
42
49
40
49
49
49
42
42
42
42
42
42
37
37
37
37
37
49
49
44
44
44
44
44
44
44
44
49
41
41
41
41
41
49
49
49
49
49
45
45
49
45
45
45
45
45
41
41
41
41
44
44
44
44
36
36
36
36
49
49
49
48
48
48
48
44
49
49
43
43
39
49
49
49
49
49
49
49
49
49
49
49
49
49
47
47
47
20
20
49
43
...

result:

ok 16667 tokens

Test #41:

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

input:

aaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabbbaaaaaabbbaaaabb...

output:

265
85
85
85
85
85
85
85
75
75
75
75
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
68
169
168
168
168
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
144
144
144
111
111
111
111
111...

result:

ok 16685 tokens

Test #42:

score: 0
Accepted
time: 3901ms
memory: 38620kb

input:

bdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbadggdabdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbadggdabdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbadggdabdcaacdbbdcaacdbbdcaacdbbdcaacdbbdcaacdbbd...

output:

30
29
25
25
25
24
22
22
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
33
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
21
21
21
21
21
21
21
21
21
21
21
21
21
21
21
18
18
18
18
18
18
18
...

result:

ok 16679 tokens

Test #43:

score: 0
Accepted
time: 4029ms
memory: 33552kb

input:

babaaababaababaaababbabaaababaababaaababbbbbbabaaababaababaaababbabaaababaababaaababbabaaababaababaaababbabaaababaababaaababbbbbbabaaababaababaaababbabaaababaababaaababbabaababbabaaababaababaaababbabaaababaababaaababbbbbbabaaababaababaaababbabaaababaababaaababbabaaababaababaaababbabaaababaababaaabab...

output:

27
27
27
27
26
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
23
15
15
15
15
15
15
15
15
15
15
15
27
27
23
23
23
23
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
27
27
27
27
27
26
26
...

result:

ok 16688 tokens

Test #44:

score: 0
Accepted
time: 3733ms
memory: 33640kb

input:

babbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbaabbbaaaabbbaabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabbaabbabbabb...

output:

42
25
43
32
26
33
38
39
49
45
45
38
24
22
11
11
49
46
27
43
33
43
31
41
24
54
42
42
59
42
28
42
37
34
41
34
48
37
35
34
27
37
44
27
23
29
19
18
39
18
38
47
36
39
28
56
30
37
29
25
22
29
24
49
25
19
27
44
31
42
43
49
44
30
57
48
41
51
26
47
37
25
28
31
45
47
35
38
40
32
34
45
41
51
51
34
38
25
44
30
...

result:

ok 16667 tokens

Test #45:

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

input:

aaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaabaaaabaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaabaaaabaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaabaaaabaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaaaabaabaaaba...

output:

21
21
22
21
8
18
19
23
22
20
15
18
15
25
18
19
6
21
21
13
26
12
15
22
16
18
19
13
16
13
17
8
14
13
18
23
24
13
12
15
17
9
9
20
19
14
12
17
16
17
11
19
15
15
24
24
19
22
16
25
28
12
12
19
17
23
15
14
17
25
21
14
17
32
11
22
19
14
19
20
13
17
16
14
15
18
12
18
23
10
11
17
22
21
16
11
22
21
13
15
4
18
...

result:

ok 16668 tokens

Test #46:

score: 0
Accepted
time: 3825ms
memory: 35604kb

input:

dbhiihbddbhiihbddbhiihbddbhiihbddbhiihbdicfhbbhfcidbhiihbddbhiihbddbhiihbddbhiihbddbhiihbddbhiihbddbhiihbddbhiihbddbhiihbddbhiihbdicfhbbhfcidbhiihbddbhiihbddbhiihbddbhiihbddbhiihbdaeahcdeiijebbejiiedchaeadbhiihbddbhiihbddbhiihbddbhiihbddbhiihbdicfhbbhfcidbhiihbddbhiihbddbhiihbddbhiihbddbhiihbddbhiih...

output:

12
10
12
7
11
11
8
10
12
19
16
20
13
16
19
17
10
16
14
11
17
14
9
14
14
14
11
9
7
10
16
10
8
14
9
17
13
13
14
13
11
17
12
12
16
7
11
14
13
8
12
10
16
13
4
14
11
9
9
7
4
5
10
13
14
9
4
8
15
14
11
16
12
12
15
11
17
8
8
14
10
14
11
9
11
11
14
14
4
13
9
5
6
8
11
13
4
5
8
9
8
7
13
5
6
11
6
10
6
9
9
4
2
1...

result:

ok 16668 tokens

Test #47:

score: 0
Accepted
time: 3831ms
memory: 33644kb

input:

cgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgccgjeffejgc...

output:

61
101
115
22
36
54
92
86
56
71
34
69
52
38
74
43
56
82
89
86
68
77
96
64
95
59
35
35
80
40
41
42
95
36
88
84
64
96
40
60
64
40
53
41
33
86
33
35
60
76
88
31
57
87
24
43
15
32
32
63
77
62
74
29
33
17
23
3
41
23
20
19
19
15
24
50
18
58
29
79
80
20
66
33
66
16
56
80
26
30
3
33
65
29
35
61
20
27
33
56
...

result:

ok 24884 tokens

Test #48:

score: 0
Accepted
time: 3802ms
memory: 33644kb

input:

onnoaidkndogsuusgodnkdiaonnoonnoaidkndogsuusgodnkdiaonnotixntqllqtnxitonnoaidkndogsuusgodnkdiaonnoonnoaidkndogsuusgodnkdiaonnoonnoaidkndogsuusgodnkdiaonnoonnoaidkndogsuusgodnkdiaonnotixntqllqtnxitonnoaidkndogsuusgodnkdiaonnoonnoaidkndogsuusgodnkdiaonnoonnoaidkndogsuusgodnkdiaonnoonnoaidkndogsuusgodn...

output:

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

result:

ok 16667 tokens

Test #49:

score: 0
Accepted
time: 3881ms
memory: 35592kb

input:

mnmymnmsmnmymnmpmnmymnmsmnmymnmrmnmymnmsmnmymnmpmnmymnmsmnmymnmpmnmymnmsmnmymnmpmnmymnmsmnmymnmrmnmymnmsmnmymnmpmnmymnmsmnmymnmpmnmymnmsmnmymnmpmnmymnmsmnmymnmrmnmymnmsmnmymnmpmnmymnmsmnmymnmpmnmymnmsmnmymnmpmnmymnmsmnmymnmrmnmymnmsmnmymnmpmnmymnmsmnmymnmumnmymnmsmnmymnmpmnmymnmsmnmymnmrmnmymnmsmnmy...

output:

10
9
5
9
7
7
10
6
7
6
10
7
10
10
10
8
6
6
8
6
9
6
7
7
9
10
9
7
3
12
7
11
9
9
5
10
5
8
3
3
5
7
6
9
5
6
8
9
7
8
4
7
8
3
7
8
10
8
6
7
5
9
7
9
6
8
9
7
8
7
12
7
9
9
9
7
9
11
8
10
10
7
10
9
6
9
10
8
6
6
8
7
11
12
7
11
10
7
10
12
10
8
7
10
8
4
5
4
8
8
12
9
6
9
10
9
6
10
9
8
6
8
9
5
7
9
5
6
9
5
4
6
6
5
4
5
...

result:

ok 16670 tokens

Test #50:

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

input:

aaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaabaaaaaaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaabaaaaaaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaabaaaaaaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaabaaabaaabaaaaaaab...

output:

19
15
18
14
15
13
16
19
12
13
14
11
14
18
12
12
12
15
11
9
16
10
17
14
18
13
11
16
12
14
11
15
15
10
16
18
17
11
15
15
9
17
9
16
14
9
8
14
9
6
9
11
6
14
13
13
16
16
13
17
16
13
14
16
15
15
13
11
9
14
16
15
14
10
7
9
18
11
9
11
13
10
10
14
12
12
11
14
9
8
9
13
12
13
14
12
10
11
14
9
14
10
11
8
7
12
1...

result:

ok 16672 tokens

Test #51:

score: 0
Accepted
time: 3864ms
memory: 35472kb

input:

iiiiiiiiiiiiiiiioxpoopxoiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioxpoopxoiiiiiiiiiiiiiiiipokkopiiiiiiiiiiiiiiiioxpoopxoiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioxpoopxoiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioxpoopxoiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioxpoopxoiiiiiiiiiiiiiiiipokkopiiiiiiiiiiiiiiiioxpoopxoiiiiiiiiiiiiiiiiiiiiiiii...

output:

271
252
259
144
132
121
135
139
127
127
144
123
127
117
119
123
132
135
134
129
128
143
134
124
143
132
131
135
117
129
122
143
143
130
132
127
120
150
132
54
32
30
53
42
32
56
53
44
33
47
44
42
47
40
54
43
35
41
44
44
50
50
59
58
41
43
32
45
44
48
42
42
30
32
36
54
48
35
39
33
40
33
32
42
33
49
36
...

result:

ok 25053 tokens

Test #52:

score: 0
Accepted
time: 3848ms
memory: 37012kb

input:

aaaabbabbbbaaaaabaaaaabbbaabbbababaababbabaaaabbbabbaabbaabbbbbaabbabbbaababbbbaabababaabbbbaaabbbaaabbaaaaaabbbbbbbbbaabbbbababaabbbbbbbbabbabaaaaabbabbabaabaabbaabaababaabbbababbaabaabbbabbabbbabaabaababbaaaaabbbbababbabaaaabbbabababbbabababaaaababbabbaabbabababbbabbaaaaaabaabaaaaabababbaaaaaabbaa...

output:

3
2
2
2
7
2
2
3
2
2
2
2
2
3
2
2
5
3
3
3
3
3
3
4
2
3
3
3
4
3
3
3
3
3
3
3
6
3
2
3
3
3
3
3
2
3
2
2
2
2
2
3
2
3
4
3
3
3
4
4
3
5
2
2
3
6
3
5
2
3
2
2
4
2
4
3
3
2
3
3
3
2
2
2
2
3
3
3
2
2
2
4
3
4
4
2
3
2
2
3
2
3
5
4
4
3
2
2
3
3
3
2
2
8
3
3
4
2
2
2
3
2
3
2
3
4
2
3
2
5
3
3
4
2
2
7
2
3
2
3
2
3
2
3
3
3
5
2
3
2
...

result:

ok 25068 tokens

Test #53:

score: 0
Accepted
time: 2541ms
memory: 36432kb

input:

bbbabaabbbabaabbaababbbaababbbbbbabaabbbabaabbaababbbaababbbbbbabaabbbabaabbaababbbaababbbbbbabaabbbabaabbaababbbaababbbbbbabaabbbabaabbaababbbaababbbbbbabaabbbabaabbaababbbaababbbbbbabaabbbabaabbaababbbaababbbbbbabaabbbabaabbaababbbaababbbbbbabaabbbabaabbaababbbaababbbbbbabaabbbabaabbaababbbaababbb...

output:

1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
1869
...

result:

ok 50000 tokens

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%