QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#282156#325. AB-StringsA_programmer100 ✓29ms8768kbC++142.6kb2023-12-11 15:06:112024-08-09 00:12:46

Judging History

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

  • [2024-08-09 00:12:46]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:29ms
  • 内存:8768kb
  • [2023-12-11 15:06:11]
  • 评测
  • 测评结果:100
  • 用时:27ms
  • 内存:7172kb
  • [2023-12-11 15:06:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
const int maxn = 2e5 + 5;

char s[maxn], t[maxn];
int a[maxn], b[maxn], lena, lenb, n, m;

bool op;
int cnt;
pii ans[maxn];
stack<int> sta, stb, pa, pb;

pii update(int x, int y)
{
	int suma = 0, sumb = 0;
	for (int i = 1; i <= x; i++) pa.push(sta.top()), suma += sta.top(), sta.pop();
	for (int i = 1; i <= y; i++) pb.push(stb.top()), sumb += stb.top(), stb.pop();
	pii ans = make_pair(suma, sumb);
	
	if (stb.size() && pa.size())
	{
		int x = pa.top();
		pa.pop();
		pa.push(x + stb.top());
		stb.pop();
	}
	if (sta.size() && pb.size())
	{
		int x = pb.top();
		pb.pop();
		pb.push(x + sta.top());
		sta.pop();
	}
	while (pa.size()) stb.push(pa.top()), pa.pop();
	while (pb.size()) sta.push(pb.top()), pb.pop();
	return ans;
}

void add(int x, int y)
{
	if (op) swap(x, y);
	ans[++cnt] = update(x, y);
	n = sta.size(), m = stb.size();
	if (op) swap(n, m);
}

void dfs(int opn)
{
	if (n > m) swap(n, m), op ^= 1;
	if (opn == 1)
	{
		if (n <= 1 && m <= 1) return;
		if (n == 1)
		{
			if (m == 2) add(1, 1), dfs(1);
			else if (m % 4 == 2) add(1, 3), dfs(1);
			else add(0, 2), dfs(0);
		}
		else if (n == 2)
		{
			if (m == 2) add(1, 1), dfs(1);
			else if (m % 4 == 1 || m % 4 == 2) add(1, 3), dfs(1);
			else if (m % 4 == 3) add(1, 1), dfs(1);
			else add(0, 2), dfs(0);
		}
		else
		{
			if ((m - n) % 4 != 2) add(1, 1), dfs(1);
			else add(0, 2), dfs(0);
		}
	}
	else
	{
		if (n == 0 || m == 0) return;
		if (n == 1)
		{
			if (m == 2) add(0, 1), dfs(1);
			else if (m % 4 == 1 || m % 4 == 2) add(0, 3), dfs(1);
			else add(0, 1), dfs(1);
		}
		else if (n == 2)
		{
			if ((m - n) % 4 == 3) add(1, 2), dfs(0);
			else add(0, 1), dfs(1);
		}
		else
		{
			if ((m - n) % 4 == 3) add(1, 0), dfs(1);
			else add(0, 1), dfs(1);
		}
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); 
	
	cin >> s + 1 >> t + 1;
	n = strlen(s + 1), m = strlen(t + 1);
	lena = n, lenb = m;
	for (int i = 1; i <= n / 2; i++) swap(s[i], s[n - i + 1]);
	for (int i = 1; i <= m / 2; i++) swap(t[i], t[m - i + 1]);
	
	int cnt1 = 0, cnt2 = 0, lsta = 0, lstb = 0;
	for (int i = 1; i <= n; i++)
		if (i == n || s[i] != s[i + 1]) sta.push(i - lsta), lsta = i;
	for (int i = 1; i <= m; i++)
		if (i == m || t[i] != t[i + 1]) stb.push(i - lstb), lstb = i;
	n = sta.size(), m = stb.size();
	dfs(s[lena] == t[lenb] ? 0 : 1);
	cout << cnt << "\n";
	for (int i = 1; i <= cnt; i++) cout << ans[i].first << " " << ans[i].second << "\n";
	return 0;
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 5588kb

input:

a
b

output:

0

result:

ok Operations: 0

Test #2:

score: 5
Accepted
time: 1ms
memory: 5672kb

input:

b
a

output:

0

result:

ok Operations: 0

Test #3:

score: 5
Accepted
time: 1ms
memory: 5872kb

input:

a
bb

output:

0

result:

ok Operations: 0

Test #4:

score: 5
Accepted
time: 1ms
memory: 5648kb

input:

b
ab

output:

1
1 1

result:

ok Operations: 1

Test #5:

score: 5
Accepted
time: 1ms
memory: 5672kb

input:

b
ba

output:

1
0 1

result:

ok Operations: 1

Test #6:

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

input:

ab
bb

output:

1
1 2

result:

ok Operations: 1

Test #7:

score: 5
Accepted
time: 1ms
memory: 5648kb

input:

ba
bb

output:

1
1 0

result:

ok Operations: 1

Test #8:

score: 5
Accepted
time: 1ms
memory: 5808kb

input:

bab
bbb

output:

2
1 0
1 4

result:

ok Operations: 2

Test #9:

score: 5
Accepted
time: 1ms
memory: 5584kb

input:

abb
bbb

output:

1
1 3

result:

ok Operations: 1

Test #10:

score: 5
Accepted
time: 1ms
memory: 5652kb

input:

a
bbbb

output:

0

result:

ok Operations: 0

Test #11:

score: 5
Accepted
time: 1ms
memory: 5892kb

input:

abbb
b

output:

1
1 1

result:

ok Operations: 1

Test #12:

score: 5
Accepted
time: 1ms
memory: 5544kb

input:

b
bbba

output:

1
0 3

result:

ok Operations: 1

Test #13:

score: 5
Accepted
time: 1ms
memory: 5668kb

input:

bbb
abbbb

output:

1
3 1

result:

ok Operations: 1

Test #14:

score: 5
Accepted
time: 1ms
memory: 5808kb

input:

bbbbba
bbbb

output:

1
5 0

result:

ok Operations: 1

Test #15:

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

input:

abbbbb
bbbbbb

output:

1
1 6

result:

ok Operations: 1

Test #16:

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

input:

bbbbba
bbbbbb

output:

1
5 0

result:

ok Operations: 1

Test #17:

score: 5
Accepted
time: 1ms
memory: 5572kb

input:

bbbbbb
bbbbba

output:

1
0 5

result:

ok Operations: 1

Test #18:

score: 5
Accepted
time: 1ms
memory: 5676kb

input:

bbabbb
bbbbbb

output:

2
2 0
1 8

result:

ok Operations: 2

Test #19:

score: 5
Accepted
time: 1ms
memory: 5608kb

input:

bbbbbb
bbbabb

output:

2
0 3
9 1

result:

ok Operations: 2

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #20:

score: 10
Accepted
time: 1ms
memory: 5672kb

input:

aaaaaa
bbbbbb

output:

0

result:

ok Operations: 0

Test #21:

score: 10
Accepted
time: 1ms
memory: 5676kb

input:

aaaaaa
aaaabb

output:

1
0 4

result:

ok Operations: 1

Test #22:

score: 10
Accepted
time: 1ms
memory: 5668kb

input:

aaaaba
aaaaaa

output:

2
4 0
1 10

result:

ok Operations: 2

Test #23:

score: 10
Accepted
time: 1ms
memory: 5592kb

input:

bbabba
bbbbbb

output:

3
2 0
3 0
0 1

result:

ok Operations: 3

Test #24:

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

input:

bbabab
bbbbbb

output:

3
4 0
1 2
3 2

result:

ok Operations: 3

Test #25:

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

input:

bbbbbb
bababa

output:

3
0 3
1 1
2 2

result:

ok Operations: 3

Test #26:

score: 10
Accepted
time: 1ms
memory: 5652kb

input:

bbbbba
bbbba

output:

2
0 4
9 1

result:

ok Operations: 2

Test #27:

score: 10
Accepted
time: 1ms
memory: 5600kb

input:

aaaaba
aaabbb

output:

2
4 0
1 7

result:

ok Operations: 2

Test #28:

score: 10
Accepted
time: 1ms
memory: 5652kb

input:

bbbbba
baaaba

output:

3
0 1
6 3
4 7

result:

ok Operations: 3

Test #29:

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

input:

baabab
bbbbaa

output:

3
3 4
5 0
1 6

result:

ok Operations: 3

Test #30:

score: 10
Accepted
time: 1ms
memory: 5588kb

input:

bababa
bbbaaa

output:

4
1 0
3 4
5 1
2 6

result:

ok Operations: 4

Test #31:

score: 10
Accepted
time: 1ms
memory: 5672kb

input:

abbbba
aaaaba

output:

3
0 4
5 1
5 6

result:

ok Operations: 3

Test #32:

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

input:

abbaa
abbabb

output:

3
0 1
2 2
4 3

result:

ok Operations: 3

Test #33:

score: 10
Accepted
time: 1ms
memory: 5612kb

input:

baabab
bbbabb

output:

4
1 0
2 4
5 3
4 7

result:

ok Operations: 4

Test #34:

score: 10
Accepted
time: 1ms
memory: 5840kb

input:

bababa
bbbabb

output:

4
0 3
6 1
2 4
5 3

result:

ok Operations: 4

Test #35:

score: 10
Accepted
time: 1ms
memory: 5540kb

input:

baabaa
baabaa

output:

4
0 1
2 2
4 3
4 6

result:

ok Operations: 4

Test #36:

score: 10
Accepted
time: 1ms
memory: 5640kb

input:

bbbaba
bababb

output:

4
0 1
4 1
2 5
6 3

result:

ok Operations: 4

Test #37:

score: 10
Accepted
time: 1ms
memory: 5592kb

input:

bababa
bbabaa

output:

5
1 0
1 3
4 2
3 5
6 5

result:

ok Operations: 5

Test #38:

score: 10
Accepted
time: 1ms
memory: 5600kb

input:

babaab
bbabab

output:

5
0 2
3 1
2 4
5 3
5 6

result:

ok Operations: 5

Test #39:

score: 10
Accepted
time: 1ms
memory: 5668kb

input:

bbabab
bababa

output:

5
0 1
3 1
2 4
5 3
4 6

result:

ok Operations: 5

Test #40:

score: 10
Accepted
time: 1ms
memory: 5864kb

input:

bababa
bababa

output:

6
0 1
2 1
2 3
4 3
4 5
6 5

result:

ok Operations: 6

Test #41:

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

input:

bbbbba
aaaaaa

output:

1
5 6

result:

ok Operations: 1

Test #42:

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

input:

aabaaa
bbbbbb

output:

2
3 0
0 2

result:

ok Operations: 2

Test #43:

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

input:

bbabba
aaaaaa

output:

3
3 0
2 0
1 4

result:

ok Operations: 3

Test #44:

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

input:

abbaba
bbbbbb

output:

3
3 0
1 0
1 2

result:

ok Operations: 3

Test #45:

score: 10
Accepted
time: 1ms
memory: 5680kb

input:

bbbbbb
ababab

output:

3
6 3
1 7
8 2

result:

ok Operations: 3

Test #46:

score: 10
Accepted
time: 1ms
memory: 5888kb

input:

bbbaa
aaaabb

output:

1
3 4

result:

ok Operations: 1

Test #47:

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

input:

bbbbba
aabaaa

output:

2
5 2
3 6

result:

ok Operations: 2

Test #48:

score: 10
Accepted
time: 1ms
memory: 5656kb

input:

bbaaaa
aababb

output:

3
0 3
2 0
3 3

result:

ok Operations: 3

Test #49:

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

input:

bbbbaa
abbaba

output:

3
4 4
1 5
7 2

result:

ok Operations: 3

Test #50:

score: 10
Accepted
time: 1ms
memory: 5612kb

input:

bababa
aaaabb

output:

3
3 4
5 1
2 6

result:

ok Operations: 3

Test #51:

score: 10
Accepted
time: 1ms
memory: 5604kb

input:

bbaaab
abaaaa

output:

2
2 1
4 3

result:

ok Operations: 2

Test #52:

score: 10
Accepted
time: 1ms
memory: 5864kb

input:

baabaa
aabba

output:

3
1 2
4 3
4 5

result:

ok Operations: 3

Test #53:

score: 10
Accepted
time: 1ms
memory: 5884kb

input:

babbab
abbbaa

output:

4
2 0
0 1
3 2
3 6

result:

ok Operations: 4

Test #54:

score: 10
Accepted
time: 1ms
memory: 5832kb

input:

aaabba
bababa

output:

4
3 1
3 6
4 4
5 5

result:

ok Operations: 4

Test #55:

score: 10
Accepted
time: 1ms
memory: 5584kb

input:

aabbab
baaaba

output:

3
2 1
3 5
6 4

result:

ok Operations: 3

Test #56:

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

input:

baabab
aabbab

output:

4
1 2
4 3
4 5
6 5

result:

ok Operations: 4

Test #57:

score: 10
Accepted
time: 1ms
memory: 5592kb

input:

bbabba
ababab

output:

5
0 2
1 0
3 2
3 4
6 4

result:

ok Operations: 5

Test #58:

score: 10
Accepted
time: 1ms
memory: 5668kb

input:

aababa
baabab

output:

4
2 1
2 4
5 3
4 6

result:

ok Operations: 4

Test #59:

score: 10
Accepted
time: 1ms
memory: 5808kb

input:

babaab
ababab

output:

5
1 1
2 2
3 3
5 4
5 6

result:

ok Operations: 5

Test #60:

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

input:

ababab
bababa

output:

5
1 1
2 2
3 3
4 4
5 5

result:

ok Operations: 5

Subtask #3:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #61:

score: 20
Accepted
time: 1ms
memory: 5612kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

0

result:

ok Operations: 0

Test #62:

score: 20
Accepted
time: 1ms
memory: 5840kb

input:

bababababababababababababababababababababababababa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

output:

25
3 0
1 1
4 2
3 2
5 4
5 3
6 6
7 4
7 8
9 5
8 10
11 6
9 12
13 7
10 14
15 8
11 16
17 9
12 18
19 10
13 20
21 11
14 22
23 12
13 24

result:

ok Operations: 25

Test #63:

score: 20
Accepted
time: 1ms
memory: 5652kb

input:

aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
ababababababababababababababababababababababababab

output:

26
0 1
20 3
1 21
22 4
2 23
24 5
3 25
26 6
4 27
28 7
5 29
30 8
6 31
32 9
7 33
34 10
8 35
36 11
9 37
38 12
10 39
40 13
11 41
42 14
12 43
44 13

result:

ok Operations: 26

Test #64:

score: 20
Accepted
time: 1ms
memory: 5648kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbaabbbbbbbbbbbbbbbbbbbb
bababababababababababababababababababababababababa

output:

26
28 0
2 31
29 3
4 32
30 5
6 33
31 7
8 34
32 9
10 35
33 11
12 36
34 13
14 37
35 15
16 38
36 17
18 39
37 19
20 40
38 21
22 41
39 23
24 42
40 25
26 41

result:

ok Operations: 26

Test #65:

score: 20
Accepted
time: 1ms
memory: 5872kb

input:

bababababababababababababababababababababababababa
bbbbbbbbbbbbbbbbbbbaaaaaaaaabbbbbbbbbbbbbbbbbbbbaa

output:

27
1 0
1 20
21 10
11 41
44 13
14 42
45 15
16 43
46 17
18 44
47 19
20 45
48 21
22 46
49 23
24 47
50 25
26 48
51 27
28 49
52 29
30 50
53 31
32 51
54 33
34 52
53 35

result:

ok Operations: 27

Test #66:

score: 20
Accepted
time: 0ms
memory: 3828kb

input:

ababababababababababababababababababababababababa
aabbbabbbbabbbaabbbabbaabaaaaabaaabaabaababbaaba

output:

37
1 0
1 3
4 4
5 5
6 9
10 7
8 13
14 10
11 17
18 12
13 20
21 15
16 22
23 21
22 24
25 25
26 26
27 28
29 28
29 31
32 30
31 33
34 33
34 36
39 35
36 37
40 37
38 38
41 39
40 39
42 41
42 40
43 43
44 41
44 45
46 42
43 47

result:

ok Operations: 37

Test #67:

score: 20
Accepted
time: 1ms
memory: 5668kb

input:

bababababababababababababababababababababababababa
bababababababababababababababababababababababababa

output:

50
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49

result:

ok Operations: 50

Test #68:

score: 20
Accepted
time: 0ms
memory: 3492kb

input:

ababababababababababababababababababababababababab
ababababababababababababababababababababababaababa

output:

49
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 47
48 46
47 49
50 48

result:

ok Operations: 49

Test #69:

score: 20
Accepted
time: 1ms
memory: 5676kb

input:

ababababababababababababababbababababababababababa
abababababababababababababababababaabababababababa

output:

49
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
29 29
30 30
31 31
32 32
33 33
34 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50

result:

ok Operations: 49

Test #70:

score: 20
Accepted
time: 1ms
memory: 5604kb

input:

abababababababababababababaabababababababbabababab
ababababababababababababababababababababababababab

output:

49
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
29 27
28 30
31 29
30 32
33 31
32 34
35 33
34 36
37 35
36 38
39 37
38 40
41 39
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50

result:

ok Operations: 49

Test #71:

score: 20
Accepted
time: 1ms
memory: 5588kb

input:

bababababababababababababababababababababababababa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

25
3 49
50 1
4 51
52 2
5 53
54 3
6 55
56 4
7 57
58 5
8 59
60 6
9 61
62 7
10 63
64 8
11 65
66 9
12 67
68 10
13 69
70 11
14 71
72 12
13 73

result:

ok Operations: 25

Test #72:

score: 20
Accepted
time: 1ms
memory: 5528kb

input:

bababababababababababababababababababababababababa
aaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

output:

25
3 14
15 1
4 16
17 2
5 18
19 3
6 20
21 4
7 22
23 5
8 24
25 6
9 26
27 7
10 28
29 8
11 30
31 9
12 32
33 10
13 34
35 11
14 36
37 12
13 38

result:

ok Operations: 25

Test #73:

score: 20
Accepted
time: 1ms
memory: 5640kb

input:

bbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbb
ababababababababababababababababababababababababab

output:

26
14 1
22 17
15 23
24 18
16 25
26 19
17 27
28 20
18 29
30 21
19 31
32 22
20 33
34 23
21 35
36 24
22 37
38 25
23 39
40 26
24 41
42 27
25 43
44 28
26 45
46 27

result:

ok Operations: 26

Test #74:

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

input:

bababababababababababababababababababababababababa
aaabbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaabbbbb

output:

27
2 0
0 1
2 4
5 29
32 20
21 30
33 22
23 31
34 24
25 32
35 26
27 33
36 28
29 34
37 30
31 35
38 32
33 36
39 34
35 37
40 36
37 38
41 38
39 39
42 40
41 40
41 42

result:

ok Operations: 27

Test #75:

score: 20
Accepted
time: 1ms
memory: 5588kb

input:

ababababababababababababababababababababababababa
babbaaaabbbbabbaaabbaabbaaababbaaaabaababaabaaab

output:

36
1 1
2 2
3 4
5 7
8 9
10 9
10 12
13 13
14 15
16 16
17 18
19 20
21 20
21 22
23 23
24 27
28 25
26 30
31 27
28 32
33 29
30 35
36 31
34 39
40 32
35 41
42 33
36 43
44 34
37 45
46 35
38 47
48 36
39 49
50 37
38 51

result:

ok Operations: 36

Test #76:

score: 20
Accepted
time: 0ms
memory: 5872kb

input:

ababababababababababababababababababababababababab
bababababababababababababababababababababababababa

output:

49
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49

result:

ok Operations: 49

Test #77:

score: 20
Accepted
time: 0ms
memory: 5612kb

input:

ababababababababababababababababababababababababab
babababababababaababababababababababababababababab

output:

49
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49

result:

ok Operations: 49

Test #78:

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

input:

bababbabababababababababababababababababababababab
abababababababababababbabababababababababababababa

output:

48
1 1
2 2
3 3
4 4
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 24
25 23
24 26
27 25
26 28
29 27
28 30
31 29
30 32
33 31
32 34
35 33
34 36
37 35
36 38
39 37
38 40
41 39
40 42
43 41
42 44
45 43
44 46
47 45
46 48
49 47
48 50

result:

ok Operations: 48

Test #79:

score: 20
Accepted
time: 0ms
memory: 5872kb

input:

bababababababababababababababababababababababababa
aabababababababababababababababababababababababaab

output:

49
2 0
0 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 50

result:

ok Operations: 49

Subtask #4:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #80:

score: 20
Accepted
time: 1ms
memory: 5876kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok Operations: 0

Test #81:

score: 20
Accepted
time: 1ms
memory: 5588kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
babababababababababababababababababababababababab...

output:

125
0 3
1 1
2 4
2 3
4 5
3 5
6 6
4 7
8 7
5 9
10 8
6 11
12 9
7 13
14 10
8 15
16 11
9 17
18 12
10 19
20 13
11 21
22 14
12 23
24 15
13 25
26 16
14 27
28 17
15 29
30 18
16 31
32 19
17 33
34 20
18 35
36 21
19 37
38 22
20 39
40 23
21 41
42 24
22 43
44 25
23 45
46 26
24 47
48 27
25 49
50 28
26 51
52 29
27 5...

result:

ok Operations: 125

Test #82:

score: 20
Accepted
time: 1ms
memory: 5668kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb
ababababababababababababababababababababababababa...

output:

126
0 1
248 3
1 249
250 4
2 251
252 5
3 253
254 6
4 255
256 7
5 257
258 8
6 259
260 9
7 261
262 10
8 263
264 11
9 265
266 12
10 267
268 13
11 269
270 14
12 271
272 15
13 273
274 16
14 275
276 17
15 277
278 18
16 279
280 19
17 281
282 20
18 283
284 21
19 285
286 22
20 287
288 23
21 289
290 24
22 291
...

result:

ok Operations: 126

Test #83:

score: 20
Accepted
time: 0ms
memory: 3840kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

126
0 146
149 53
54 147
150 55
56 148
151 57
58 149
152 59
60 150
153 61
62 151
154 63
64 152
155 65
66 153
156 67
68 154
157 69
70 155
158 71
72 156
159 73
74 157
160 75
76 158
161 77
78 159
162 79
80 160
163 81
82 161
164 83
84 162
165 85
86 163
166 87
88 164
167 89
90 165
168 91
92 166
169 93
94 ...

result:

ok Operations: 126

Test #84:

score: 20
Accepted
time: 1ms
memory: 5664kb

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
bbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

127
1 0
1 11
12 71
72 131
134 123
124 132
135 125
126 133
136 127
128 134
137 129
130 135
138 131
132 136
139 133
134 137
140 135
136 138
141 137
138 139
142 139
140 140
143 141
142 141
144 143
144 142
145 145
146 143
146 147
148 144
147 149
150 145
148 151
152 146
149 153
154 147
150 155
156 148
15...

result:

ok Operations: 127

Test #85:

score: 20
Accepted
time: 1ms
memory: 5852kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababababababababababababababababa...

output:

250
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
52 ...

result:

ok Operations: 250

Test #86:

score: 20
Accepted
time: 1ms
memory: 5652kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababababababababababaabababababab...

output:

249
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 39
40 38
39 41
42 40
41 43
44 42
43 45
46 44
45 47
48 46
47 49
50 48
49 51
52 50
51 53
54 ...

result:

ok Operations: 249

Test #87:

score: 20
Accepted
time: 1ms
memory: 5884kb

input:

abababababababababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
ababababababababababababababababababababababababa...

output:

249
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
52 ...

result:

ok Operations: 249

Test #88:

score: 20
Accepted
time: 1ms
memory: 5884kb

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababa
bababaabaaaaabababbaababbbbbbabbabbabbbbbabbaaabba...

output:

199
1 0
1 2
3 2
3 4
5 4
5 6
7 7
8 8
9 13
14 10
11 15
16 12
13 17
18 15
16 20
21 17
18 22
23 24
25 24
25 27
28 26
27 30
31 28
29 36
37 30
31 39
40 34
35 42
43 37
38 45
46 40
41 48
49 42
43 50
51 44
45 52
53 46
47 55
56 50
51 60
61 53
54 62
63 55
56 65
66 58
59 67
68 61
62 75
76 64
65 77
78 68
69 79
8...

result:

ok Operations: 199

Test #89:

score: 20
Accepted
time: 1ms
memory: 5844kb

input:

abababababaabbaaabababababababbbaaababaaabbaababaababaabababaabaababbabababaababaabababababaabbabaabaabbabababbabbaaabaabababababababaababbaabaababbbabababaaabaabaabbababababbabaabaababbabbaababababaabbababaaabbaababaabaababababababbaabaabababbababba
aaaaaaaaaaaabbbaaabaaaaabbbbbbbbbbbaaaaaaaaaaabbb...

output:

111
1 0
1 13
14 4
5 17
18 6
7 23
24 18
19 35
36 26
27 40
42 29
31 60
63 52
53 72
73 57
58 79
80 75
76 82
83 83
84 84
85 97
98 88
89 99
100 91
92 118
121 94
97 133
134 126
127 137
138 128
135 147
148 131
135 150
151 132
136 152
153 133
136 154
155 134
139 156
157 136
140 158
159 137
140 161
162 138
1...

result:

ok Operations: 111

Test #90:

score: 20
Accepted
time: 1ms
memory: 5672kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

125
3 250
251 1
4 252
253 2
5 254
255 3
6 256
257 4
7 258
259 5
8 260
261 6
9 262
263 7
10 264
265 8
11 266
267 9
12 268
269 10
13 270
271 11
14 272
273 12
15 274
275 13
16 276
277 14
17 278
279 15
18 280
281 16
19 282
283 17
20 284
285 18
21 286
287 19
22 288
289 20
23 290
291 21
24 292
293 22
25 2...

result:

ok Operations: 125

Test #91:

score: 20
Accepted
time: 1ms
memory: 5640kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
babababababababababababababababababababababababab...

output:

125
205 3
1 206
207 4
2 208
209 5
3 210
211 6
4 212
213 7
5 214
215 8
6 216
217 9
7 218
219 10
8 220
221 11
9 222
223 12
10 224
225 13
11 226
227 14
12 228
229 15
13 230
231 16
14 232
233 17
15 234
235 18
16 236
237 19
17 238
239 20
18 240
241 21
19 242
243 22
20 244
245 23
21 246
247 24
22 248
249 ...

result:

ok Operations: 125

Test #92:

score: 20
Accepted
time: 0ms
memory: 5656kb

input:

aaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
babababababababababababababababababababababababab...

output:

126
5 1
144 8
6 145
146 9
7 147
148 10
8 149
150 11
9 151
152 12
10 153
154 13
11 155
156 14
12 157
158 15
13 159
160 16
14 161
162 17
15 163
164 18
16 165
166 19
17 167
168 20
18 169
170 21
19 171
172 22
20 173
174 23
21 175
176 24
22 177
178 25
23 179
180 26
24 181
182 27
25 183
184 28
26 185
186 ...

result:

ok Operations: 126

Test #93:

score: 20
Accepted
time: 0ms
memory: 3840kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ababababababababababababababababababababababababa...

output:

127
0 2
1 0
125 2
34 126
166 37
35 167
168 38
36 169
170 39
37 171
172 40
38 173
174 41
39 175
176 42
40 177
178 43
41 179
180 44
42 181
182 45
43 183
184 46
44 185
186 47
45 187
188 48
46 189
190 49
47 191
192 50
48 193
194 51
49 195
196 52
50 197
198 53
51 199
200 54
52 201
202 55
53 203
204 56
54...

result:

ok Operations: 127

Test #94:

score: 20
Accepted
time: 1ms
memory: 5608kb

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
ababababababababababababababababababababababababa...

output:

249
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
53...

result:

ok Operations: 249

Test #95:

score: 20
Accepted
time: 0ms
memory: 5584kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
babababababababababababababababababababababababab...

output:

249
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
53...

result:

ok Operations: 249

Test #96:

score: 20
Accepted
time: 0ms
memory: 3836kb

input:

bababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababbabababababababababababababab...

output:

248
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
52 53
54...

result:

ok Operations: 248

Test #97:

score: 20
Accepted
time: 1ms
memory: 5588kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababbabababababababab
bababbaababbbababababaabaabbbbabbaaaababbbababaaab...

output:

199
2 0
0 1
2 2
3 3
4 4
5 5
6 7
8 8
9 9
10 10
11 13
14 12
13 15
16 14
15 17
18 16
17 19
20 18
19 21
22 21
22 23
24 24
25 28
29 26
27 31
32 31
32 33
34 33
34 37
38 35
36 39
40 37
38 41
42 41
42 43
44 43
44 46
47 45
46 48
49 47
48 50
51 49
50 53
54 53
54 56
57 57
58 62
63 60
61 67
68 62
63 70
71 64
65...

result:

ok Operations: 199

Test #98:

score: 20
Accepted
time: 1ms
memory: 5648kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbaaaaaaaaabbbbbaabbbbbbbbbbbaaaabbbaaaabbbbbbbbabbbaaaaaaaaaabbbbbaaaaaaaaaaaabbbbbbbbbaaabbbbbbbbbbbbbbbaaaaaaaaaaaaaaaabaaaaaaaaaaabbbbbbbbbbbbbbbbbaaaaaabbbbbbbbaaaaabbbbbbbbbbbbaaaaaaaabbbbbbbbbbbbbaaabaaa
baababababaabababbabababababbababababababababaaaba...

output:

110
31 1
11 33
42 12
17 43
45 18
29 46
50 30
33 51
55 34
42 57
58 43
46 59
69 47
52 70
82 54
63 83
86 64
79 87
103 80
81 104
115 82
99 116
122 100
108 123
128 110
122 129
137 123
136 138
141 137
138 144
142 139
140 145
143 141
142 146
144 143
144 149
147 145
146 151
148 147
148 154
149 149
150 152
1...

result:

ok Operations: 110

Subtask #5:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #99:

score: 20
Accepted
time: 0ms
memory: 3836kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok Operations: 0

Test #100:

score: 20
Accepted
time: 1ms
memory: 5868kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

1001
0 1
0 2
1 2
0 2
3 3
1 4
5 4
2 6
7 5
3 8
9 6
4 10
11 7
5 12
13 8
6 14
15 9
7 16
17 10
8 18
19 11
9 20
21 12
10 22
23 13
11 24
25 14
12 26
27 15
13 28
29 16
14 30
31 17
15 32
33 18
16 34
35 19
17 36
37 20
18 38
39 21
19 40
41 22
20 42
43 23
21 44
45 24
22 46
47 25
23 48
49 26
24 50
51 27
25 52
53...

result:

ok Operations: 1001

Test #101:

score: 20
Accepted
time: 1ms
memory: 5672kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1001
1 0
1 1928
1931 74
75 1929
1932 76
77 1930
1933 78
79 1931
1934 80
81 1932
1935 82
83 1933
1936 84
85 1934
1937 86
87 1935
1938 88
89 1936
1939 90
91 1937
1940 92
93 1938
1941 94
95 1939
1942 96
97 1940
1943 98
99 1941
1944 100
101 1942
1945 102
103 1943
1946 104
105 1944
1947 106
107 1945
1948...

result:

ok Operations: 1001

Test #102:

score: 20
Accepted
time: 1ms
memory: 3792kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

1001
0 1
90 1
1703 93
91 1704
1705 94
92 1706
1707 95
93 1708
1709 96
94 1710
1711 97
95 1712
1713 98
96 1714
1715 99
97 1716
1717 100
98 1718
1719 101
99 1720
1721 102
100 1722
1723 103
101 1724
1725 104
102 1726
1727 105
103 1728
1729 106
104 1730
1731 107
105 1732
1733 108
106 1734
1735 109
107 1...

result:

ok Operations: 1001

Test #103:

score: 20
Accepted
time: 1ms
memory: 5864kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1002
0 1
223 1
1434 224
248 1437
1435 249
250 1438
1436 251
252 1439
1437 253
254 1440
1438 255
256 1441
1439 257
258 1442
1440 259
260 1443
1441 261
262 1444
1442 263
264 1445
1443 265
266 1446
1444 267
268 1447
1445 269
270 1448
1446 271
272 1449
1447 273
274 1450
1448 275
276 1451
1449 277
278 14...

result:

ok Operations: 1002

Test #104:

score: 20
Accepted
time: 0ms
memory: 5636kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

2000
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
52...

result:

ok Operations: 2000

Test #105:

score: 20
Accepted
time: 1ms
memory: 3836kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
53...

result:

ok Operations: 1999

Test #106:

score: 20
Accepted
time: 1ms
memory: 3612kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
52...

result:

ok Operations: 1999

Test #107:

score: 20
Accepted
time: 1ms
memory: 5632kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1998
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
52...

result:

ok Operations: 1998

Test #108:

score: 20
Accepted
time: 1ms
memory: 5900kb

input:

aaaaaaaaabbbbaaaaaabbbbbbaaaaabbbbbbbbbbbbbbbbbbbbbbaaabbbbaaaabaabbabbaaaabbbaaaaaaaaaabbbbbbaaaabbbbbbbbbbbbbabbbbbbbaaaabbbbbbbaaaaaabbbbbbbbbbbabbbaaababbaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbaaaaaabbbbbbbbbbbbaaabbbbbbbbaaaaaaabbaaaaaaaaabbbbbbbaabaaaaaaaaaaaaaaaaabbbbbbbbb...

output:

1114
0 2
11 1
5 13
19 6
12 20
25 13
35 26
29 36
40 30
34 41
42 36
38 43
45 39
40 46
48 41
45 49
52 46
56 53
59 57
61 60
73 62
63 74
81 64
68 82
89 69
75 90
101 76
77 102
105 78
81 106
107 82
83 110
112 84
101 113
151 103
104 152
155 105
111 157
169 112
115 170
178 116
123 179
181 124
133 182
189 134...

result:

ok Operations: 1114

Test #109:

score: 20
Accepted
time: 1ms
memory: 5616kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1001
2 0
1 0
3 2
3 1
4 4
5 2
5 6
7 3
6 8
9 4
7 10
11 5
8 12
13 6
9 14
15 7
10 16
17 8
11 18
19 9
12 20
21 10
13 22
23 11
14 24
25 12
15 26
27 13
16 28
29 14
17 30
31 15
18 32
33 16
19 34
35 17
20 36
37 18
21 38
39 19
22 40
41 20
23 42
43 21
24 44
45 22
25 46
47 23
26 48
49 24
27 50
51 25
28 52
53 26...

result:

ok Operations: 1001

Test #110:

score: 20
Accepted
time: 1ms
memory: 5896kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1001
2 0
0 1
4 1891
1892 2
5 1893
1894 3
6 1895
1896 4
7 1897
1898 5
8 1899
1900 6
9 1901
1902 7
10 1903
1904 8
11 1905
1906 9
12 1907
1908 10
13 1909
1910 11
14 1911
1912 12
15 1913
1914 13
16 1915
1916 14
17 1917
1918 15
18 1919
1920 16
19 1921
1922 17
20 1923
1924 18
21 1925
1926 19
22 1927
1928 ...

result:

ok Operations: 1001

Test #111:

score: 20
Accepted
time: 1ms
memory: 5868kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1001
1 300
301 1687
1690 315
316 1688
1691 317
318 1689
1692 319
320 1690
1693 321
322 1691
1694 323
324 1692
1695 325
326 1693
1696 327
328 1694
1697 329
330 1695
1698 331
332 1696
1699 333
334 1697
1700 335
336 1698
1701 337
338 1699
1702 339
340 1700
1703 341
342 1701
1704 343
344 1702
1705 345
3...

result:

ok Operations: 1001

Test #112:

score: 20
Accepted
time: 1ms
memory: 3656kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1001
559 1
376 560
1045 379
377 1046
1047 380
378 1048
1049 381
379 1050
1051 382
380 1052
1053 383
381 1054
1055 384
382 1056
1057 385
383 1058
1059 386
384 1060
1061 387
385 1062
1063 388
386 1064
1065 389
387 1066
1067 390
388 1068
1069 391
389 1070
1071 392
390 1072
1073 393
391 1074
1075 394
39...

result:

ok Operations: 1001

Test #113:

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

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
5...

result:

ok Operations: 1999

Test #114:

score: 20
Accepted
time: 1ms
memory: 5692kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1999
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
5...

result:

ok Operations: 1999

Test #115:

score: 20
Accepted
time: 0ms
memory: 5848kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1998
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
5...

result:

ok Operations: 1998

Test #116:

score: 20
Accepted
time: 1ms
memory: 5652kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1998
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
5...

result:

ok Operations: 1998

Test #117:

score: 20
Accepted
time: 1ms
memory: 5568kb

input:

abababababababababababababaababaabababababababababababababababababababaababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababbabababababababaababababababababababababababababababababababababaabababbabababababababababababababbabababa...

output:

1114
1 6
7 5
6 20
21 32
33 38
39 34
35 40
41 44
45 44
45 50
51 52
53 63
64 68
69 72
73 79
80 79
80 92
93 81
82 96
97 91
92 99
100 100
101 111
112 105
106 120
121 121
123 127
128 151
152 129
130 168
170 131
132 179
180 134
135 190
191 145
146 203
204 156
157 209
210 158
159 215
216 167
168 222
223 17...

result:

ok Operations: 1114

Subtask #6:

score: 25
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #118:

score: 25
Accepted
time: 1ms
memory: 5700kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok Operations: 0

Test #119:

score: 25
Accepted
time: 10ms
memory: 6920kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
0 1
0 2
1 2
0 2
3 3
1 4
5 4
2 6
7 5
3 8
9 6
4 10
11 7
5 12
13 8
6 14
15 9
7 16
17 10
8 18
19 11
9 20
21 12
10 22
23 13
11 24
25 14
12 26
27 15
13 28
29 16
14 30
31 17
15 32
33 18
16 34
35 19
17 36
37 20
18 38
39 21
19 40
41 22
20 42
43 23
21 44
45 24
22 46
47 25
23 48
49 26
24 50
51 27
25 52
...

result:

ok Operations: 100001

Test #120:

score: 25
Accepted
time: 14ms
memory: 5496kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100001
1 0
1 103541
103544 96461
96462 103542
103545 96463
96464 103543
103546 96465
96466 103544
103547 96467
96468 103545
103548 96469
96470 103546
103549 96471
96472 103547
103550 96473
96474 103548
103551 96475
96476 103549
103552 96477
96478 103550
103553 96479
96480 103551
103554 96481
96482 1...

result:

ok Operations: 100001

Test #121:

score: 25
Accepted
time: 14ms
memory: 7208kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
0 1
70714 1
113659 70717
70715 113660
113661 70718
70716 113662
113663 70719
70717 113664
113665 70720
70718 113666
113667 70721
70719 113668
113669 70722
70720 113670
113671 70723
70721 113672
113673 70724
70722 113674
113675 70725
70723 113676
113677 70726
70724 113678
113679 70727
70725 11...

result:

ok Operations: 100001

Test #122:

score: 25
Accepted
time: 14ms
memory: 5836kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100002
1 0
1 86420
86421 28390
28393 161144
161145 28391
28394 161146
161147 28392
28395 161148
161149 28393
28396 161150
161151 28394
28397 161152
161153 28395
28398 161154
161155 28396
28399 161156
161157 28397
28400 161158
161159 28398
28401 161160
161161 28399
28402 161162
161163 28400
28403 161...

result:

ok Operations: 100002

Test #123:

score: 25
Accepted
time: 14ms
memory: 7448kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100002
0 4940
4941 39805
39806 53406
53409 137876
137877 53407
53410 137878
137879 53408
53411 137880
137881 53409
53412 137882
137883 53410
53413 137884
137885 53411
53414 137886
137887 53412
53415 137888
137889 53413
53416 137890
137891 53414
53417 137892
137893 53415
53418 137894
137895 53416
534...

result:

ok Operations: 100002

Test #124:

score: 25
Accepted
time: 19ms
memory: 6256kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

150000
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
...

result:

ok Operations: 150000

Test #125:

score: 25
Accepted
time: 26ms
memory: 8292kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

200000
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
...

result:

ok Operations: 200000

Test #126:

score: 25
Accepted
time: 23ms
memory: 7160kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
...

result:

ok Operations: 199999

Test #127:

score: 25
Accepted
time: 26ms
memory: 7204kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

199999
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
...

result:

ok Operations: 199999

Test #128:

score: 25
Accepted
time: 26ms
memory: 8716kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
...

result:

ok Operations: 199999

Test #129:

score: 25
Accepted
time: 22ms
memory: 8572kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
...

result:

ok Operations: 199998

Test #130:

score: 25
Accepted
time: 22ms
memory: 8704kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
...

result:

ok Operations: 199998

Test #131:

score: 25
Accepted
time: 15ms
memory: 5608kb

input:

aaababbaabbbbaababababababbbabbaaaababbabababbabaabbbabbabbbbabaaabbbaaabbababbaabbbaabbbababbaabbabaababbbaaaabbbababbbabbabaaaabbbababababaababaababbaabbbbbbabbaaabbbaaaababababaaabbbabbbaabaabbabaabababaaabaaabaaabababaabababbbaaababaaabaabbbbababaababbababbabaabbbaababababbbababaabbababbbabbbbaa...

output:

101948
3 0
1 4
5 3
5 6
8 6
10 11
13 13
14 14
15 15
16 17
18 17
18 21
22 22
23 25
26 25
26 27
28 29
32 29
30 39
41 32
36 42
43 39
40 47
49 49
50 52
53 56
57 54
55 60
61 58
60 63
64 62
63 67
69 68
71 71
72 73
75 73
74 77
81 76
77 84
85 81
84 87
90 87
90 97
99 96
97 100
101 101
102 103
105 105
107 107
...

result:

ok Operations: 101948

Test #132:

score: 25
Accepted
time: 10ms
memory: 7668kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
0 2
0 1
2 3
1 3
4 4
2 5
6 5
3 7
8 6
4 9
10 7
5 11
12 8
6 13
14 9
7 15
16 10
8 17
18 11
9 19
20 12
10 21
22 13
11 23
24 14
12 25
26 15
13 27
28 16
14 29
30 17
15 31
32 18
16 33
34 19
17 35
36 20
18 37
38 21
19 39
40 22
20 41
42 23
21 43
44 24
22 45
46 25
23 47
48 26
24 49
50 27
25 51
52 28
26 ...

result:

ok Operations: 100001

Test #133:

score: 25
Accepted
time: 14ms
memory: 7492kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100001
2 0
0 1
4 121208
121209 2
5 121210
121211 3
6 121212
121213 4
7 121214
121215 5
8 121216
121217 6
9 121218
121219 7
10 121220
121221 8
11 121222
121223 9
12 121224
121225 10
13 121226
121227 11
14 121228
121229 12
15 121230
121231 13
16 121232
121233 14
17 121234
121235 15
18 121236
121237 16...

result:

ok Operations: 100001

Test #134:

score: 25
Accepted
time: 10ms
memory: 7152kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
74153 1
32162 74154
167840 32165
32163 167841
167842 32166
32164 167843
167844 32167
32165 167845
167846 32168
32166 167847
167848 32169
32167 167849
167850 32170
32168 167851
167852 32171
32169 167853
167854 32172
32170 167855
167856 32173
32171 167857
167858 32174
32172 167859
167860 32175
...

result:

ok Operations: 100001

Test #135:

score: 25
Accepted
time: 10ms
memory: 7688kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100001
1 86958
86959 4463
4466 107847
107848 4464
4467 107849
107850 4465
4468 107851
107852 4466
4469 107853
107854 4467
4470 107855
107856 4468
4471 107857
107858 4469
4472 107859
107860 4470
4473 107861
107862 4471
4474 107863
107864 4472
4475 107865
107866 4473
4476 107867
107868 4474
4477 10786...

result:

ok Operations: 100001

Test #136:

score: 25
Accepted
time: 10ms
memory: 5828kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100002
1 13939
13940 5289
5290 71239
71242 54547
54548 71240
71243 54549
54550 71241
71244 54551
54552 71242
71245 54553
54554 71243
71246 54555
54556 71244
71247 54557
54558 71245
71248 54559
54560 71246
71249 54561
54562 71247
71250 54563
54564 71248
71251 54565
54566 71249
71252 54567
54568 71250...

result:

ok Operations: 100002

Test #137:

score: 25
Accepted
time: 20ms
memory: 8040kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

150000
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 150000

Test #138:

score: 25
Accepted
time: 17ms
memory: 7164kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 199999

Test #139:

score: 25
Accepted
time: 17ms
memory: 8436kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

199998
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 199998

Test #140:

score: 25
Accepted
time: 29ms
memory: 8036kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 199999

Test #141:

score: 25
Accepted
time: 22ms
memory: 8692kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
2 0
0 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
5...

result:

ok Operations: 199999

Test #142:

score: 25
Accepted
time: 21ms
memory: 7208kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 199998

Test #143:

score: 25
Accepted
time: 17ms
memory: 8768kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199997
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 199997

Test #144:

score: 25
Accepted
time: 16ms
memory: 7884kb

input:

aaabaaaababababbaabababbabaaaaaabbaabababbaabbbabaabaaaabbaabbbabbaaababbbaabbbbaabaabaaabaabaabaabababaaaabaaabaabbbbabbababbbabbaababababbabbaabbbbabaaababbbabbabaaaabbabaabaaaabbbababaaaabaababababbaabbbbababababaaabaabbbbabaaababbbababababbaaabaaaabaabbaababbaababbabbabbababababbababbbabbbbaaaaa...

output:

101948
4 0
0 3
7 4
5 10
11 9
10 13
14 11
12 16
17 13
15 18
20 17
18 21
22 19
20 23
24 27
29 26
27 30
31 29
35 32
34 37
39 35
36 43
44 37
38 45
46 39
41 48
50 42
45 51
52 49
50 55
57 51
52 58
62 53
55 66
68 56
59 70
71 60
62 72
75 64
65 78
79 66
69 81
83 72
76 87
89 78
79 91
93 80
81 94
97 82
83 98
1...

result:

ok Operations: 101948

Extra Test:

score: 0
Extra Test Passed