QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#561144#8223. 字符串游戏The_cosmos100 ✓653ms507732kbC++143.1kb2024-09-12 20:37:592024-09-12 20:38:00

Judging History

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

  • [2024-09-12 20:38:00]
  • 评测
  • 测评结果:100
  • 用时:653ms
  • 内存:507732kb
  • [2024-09-12 20:37:59]
  • 提交

answer

#include <bits/stdc++.h>
#define REP(i, first, last) for(int i = (first); i <= (last); ++ i)
#define DOW(i, first, last) for(int i = (first); i >= (last); -- i)
using namespace std;
// #define int long long
#define pb emplace_back
#define ull unsigned long long
const int N = 2e6 + 5, M = 2e5 + 5, Sg = 26;
const int mod1 = 1e9 + 9, mod2 = 998244353;
const long long inf = 1e18;
const int dx[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
const int dy[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
const int P = 1ll << 21, S = P - 1;
struct Graph {
	struct edge { int from, to, next; int w; } e[N << 1]; int cnt, n, head[N];
	void ins(int u, int v, int w = 0) { e[++ cnt] = {u, v, head[u], w}, n = max({n, u, v}), head[u] = cnt; }
	void twi(int u, int v, int w = 0) { ins(u, v, w), ins(v, u, w); }
	void clear() { for (int i = 1; i <= cnt; i ++) head[e[i].from] = 0; cnt = 0; }
	#define FEG(u, v, W, G, i) \
		for (int i = G.head[u], v = G.e[i].to, W = G.e[i].w; i; i = G.e[i].next, v = G.e[i].to, W = G.e[i].w)
} G;
struct SAM {
	struct imfor {
		int ch[27];
		int len, fa;
	} s[N << 1];
	int lst = 1, tot = 1;
	int siz[N << 1];
	int Ins(int c) {
		int p = lst, np = ++ tot;
		lst = np, s[np].len = s[p].len + 1;
		while(p && !s[p].ch[c]) 
			s[p].ch[c] = np, p = s[p].fa;
		if(!p) s[np].fa = 1;
		else {
			int q = s[p].ch[c];
			if(s[q].len == s[p].len + 1) s[np].fa = q;
			else {
				int nq = ++ tot;
				s[nq] = s[q];
				s[nq].len = s[p].len + 1;
				s[q].fa = s[np].fa = nq;
				while(p && s[p].ch[c] == q) 
					s[p].ch[c] = nq, p = s[p].fa;
			}
		}
		return np;
	}	
	void Build() { REP(i, 2, tot) G.ins(s[i].fa, i); }
} sam;
template <typename T>
struct Fenwick {
	int n; vector<T> c;
	void resize(int x) { n = x, c.resize(n + 1); }
	void clear() { c.assign(n + 1, 0); }
	void upd(int x) { int val = 1; for (; x <= n; x += x & -x) c[x] += val; }
	T ask(int x) { T r = 0; for (x = min(x, n); x; x -= x & -x) r += c[x]; return r; }
};
Fenwick<int> fw;
int n, pl[N], fa[N][25], dfn[N], low[N], idx;
char s[N];
void build(int x, int lst) {
	fa[x][0] = lst, dfn[x] = ++ idx;
	for(int i = 1; fa[x][i - 1]; i ++) 
		fa[x][i] = fa[fa[x][i - 1]][i - 1];
	FEG(x, v, w, G, i) build(v, x);
	low[x] = idx;
}
int f[N];
void upd(int x) {
	// cerr << pl[x] << '\n';
	fw.upd(dfn[pl[x]]);
}
int qry(int l, int r) {
	l = r - l + 1, r = pl[r];
	DOW(i, 21, 0) if(sam.s[fa[r][i]].len >= l) r = fa[r][i];
	return fw.ask(low[r]) - fw.ask(dfn[r] - 1);
}
stack<int> st;
void Solve() {
	cin >> (s + 1), fw.resize(N);
	n = strlen(s + 1);
	reverse(s + 1, s + n + 1);
	REP(i, 1, n) pl[i] = sam.Ins(s[i] - 97);
	sam.Build(), build(1, 0);
	// cerr << "qwq";
	REP(i, 1, n) {
		f[i] = 1, upd(i);
		// cerr << "qwq\n";
		while(!st.empty()) {
			f[i] = max(f[i], qry(st.top() + 1, i) - f[st.top()]);
			if(f[i] <= f[st.top()]) st.pop();
			else break;
		}
		st.push(i);
	}
	cout << f[n] << '\n';
}
signed main() {
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	int T = 1;
//	cin >> T;
	while (T --) {
		Solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

abbabbbbabbaaaaabbbaabaaaaaabbbaabbabababaabababaababaaaaaabaaabaaabbbbababaaabbbabababbbabbbaabaaababbbaabaabbaaabbababaaaaabbbaabaaabbaabaabaaabaaabaababaabbbbbbbbabbbbbabbbaabababbaababbbbbabbbbaaabbaabaabaaabbabbaaabbaaababaabbbaabbbaaaabbababbabaababababaaaabbaaaabaabaaaababaaabababbbaaabababbb...

output:

1281

result:

ok single line: '1281'

Test #2:

score: 10
Accepted
time: 3ms
memory: 27316kb

input:

aaaabababbabbbbbabbbbbbbbbbbabbbbbabbbaaabbbbaababaabbbbbbbbbbbbbabaabbaaabaababaabaaabbabbbabbbabaabbaabaababbbbbbaaabbbbaaabaabbbabbbabbabaabbbbabbbaabaaaabbbbbabaaaabaabbabaaabbaabbabbaaabbabaaababbababababaabaaaabaabaabaaabaabbbabbbbbaababbabbbabbbbababaaabbabbaaaabbbaaabaabbbaaaaaababaababbbbba...

output:

1483

result:

ok single line: '1483'

Test #3:

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

input:

bbaaababbbabbbaabbbbbbababbbabbbbbbbbaabbbbbbbbbbaaabbbbbbbbbbbbbbbabbabbbabaababbbabbbbabbabbabbbbabbbbbbbbbaaababbaaabbbaabbabbbbbbbbbbbbbbbbbbbbabbbbbbababababbbbbbbbbabababaabbbbbbabbbbaabbababbaaababbbbabbbbabbbabbbbbabbbbbabbbbbbbbbbabbaabbbabababbbbaababbbababbbbabbabbaabbbbbbabbbbbababbbbaba...

output:

2310

result:

ok single line: '2310'

Test #4:

score: 10
Accepted
time: 5ms
memory: 25388kb

input:

abbbbbbbbababbbbbbbbbabbbbbbbbabbbabbbbbaaabbbbbabbbbababbbabbbbbbaabbabbbbbaabbbbabbabbbbbbbabbbbaaabbbbbbaabbbbbbbbbbbbbbbbbbbbbabbbabbbabbbbbbbabbbbbbbabbbabbbbbbbbabbbabbbbbbbbbbbbbbbbbaababbbbbbbbbbabbbbbbbbbbbbbababbbbbbbabbbbbbababbbabbbbbaabbbbbbbbbaabbabbbbaabbbabbbbbbbbbbbbbabbbbbbbbbbbbbb...

output:

1

result:

ok single line: '1'

Test #5:

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

input:

bbbabbbbbbbbbbbbbbbbbbbbabbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbabbbabbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbabbbbabbabbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbabbbbbbbbbbbabbbbbbbbbbbbbbbbbbbabbbbbbabbabbbbbbaabbbabbbbbbbbbbbbbbbbabbbbbabbbabbbbbbbabbbababbabbbbba...

output:

3680

result:

ok single line: '3680'

Test #6:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbb...

output:

2454

result:

ok single line: '2454'

Test #7:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

2702

result:

ok single line: '2702'

Test #8:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

2499

result:

ok single line: '2499'

Test #9:

score: 10
Accepted
time: 2ms
memory: 27500kb

input:

amahaaajakalaiacabararasafaxasagamajaqagaqaeauauayagasadazavaeagabaaajalajavalatauapacaearaeagafawaaapawadaiaaapalahanavazasayamaiafagabahaxanacaaagaoadasakayagawaiaharanamaraiaramazaoagajataoazasalavatafaoalacaqavanafatajawauayakaoaqawawayasatasazagafacayasasawaqayadasaiazaxamaaaragataxawazadalaxak...

output:

2475

result:

ok single line: '2475'

Test #10:

score: 10
Accepted
time: 5ms
memory: 29428kb

input:

afabagadaeaeacaeaeafagafagababaaagacabaaagadacafadabaaaaacadaaagafacagadaeacacacabadagadaaabafadafadadaeafaaagadafabaeaaafaeaeaaaeabaaabaaaeafagadaaaaacaeaaaaacabaeacadagafafacacabaeaaagagaeaaadagabadaaaaagafagaaabaaaaafacafacadaaagabaaafadagacaaafafadadadacadadaaacagabacaaabacaeadabacagaeagagafafag...

output:

2807

result:

ok single line: '2807'

Subtask #2:

score: 10
Accepted

Test #11:

score: 10
Accepted
time: 653ms
memory: 501236kb

input:

aaaaaaabbaaabbbbabbabbbababaabaaabaabbaaababaaaaaabbbbbaabbbabbbaabbabaababaababaabbbababbbabaaaaaaaaabaaaaabbbabbbbbabaaabaaaababbabbbbbbaabbbbbaababbbbababbbbbbbbbbbaaabbabbaababbaaaabbabaaabbaaabbbbaaababbbbbabbaababbaaababaaabbabaabbbbabbaaabbababbaabbaaaaaaaaaabababbbaaaababbabbbabbababbabbabbb...

output:

234567

result:

ok single line: '234567'

Test #12:

score: 10
Accepted
time: 631ms
memory: 503992kb

input:

aababbbbaaabaabababbbaabbabbaabbaababaabaabaabbbaaaabbabbbbbaaaaabbbaabbbaaaaaaaabbbabaabbbaabaaabaabbabbabbbaaabbbbbaabaabaaaaabbbabbaaaababbaaababbbbaaabaabbababbbbbaaabbaabaaaaaaabbbbbaabbaaabaababababbbbabbbbaabbababbbbbaabbabaaaaabbabbbabbaaaababababbbabaabababaaabbbbaaabbabababaabaabaaabbabaab...

output:

198433

result:

ok single line: '198433'

Test #13:

score: 10
Accepted
time: 633ms
memory: 503024kb

input:

bababbbabaaabbbaabaabaababbbaabaabaaaaaabaaaaaaaabaaabbabbaaaaababbbbbbababaabbaabbabaabaaabaaaabbbbbaaabbababbabbbabbbaaaabbbbaaabbaabbbababbbabbbbabbbbabbbbabaaaabaaaabababbaaabbaaabbaabbbbbababababbbbbbbbabaaabaaaaaaabbbabbabbbaaabbbabbababaabababaabbabbbabaaabbaabbabbbababaababaaabaabababaababbb...

output:

248857

result:

ok single line: '248857'

Test #14:

score: 10
Accepted
time: 631ms
memory: 507732kb

input:

aabababababbaaaababbaabbabaaaaaababbaabaaabbaaaaabaaabbaababbbaaaabbbaabbabbaaaabaaabbbaaaababbbbaabaabbaabaaaaaabababaabbaaabbbaaabbabababaabaaaababaaaaabbbbabbaabbbababbbbaaaaabbbabaabbbaababaabbaaababbaabababbabaaabbbabbbbabaaabaaabbbaabbbaabbbabbbbabaaabbabababbbbabababbbbbbaaababaababaabaabbbbb...

output:

257032

result:

ok single line: '257032'

Test #15:

score: 10
Accepted
time: 616ms
memory: 505508kb

input:

bbbababbaaabbaababaaababaaaababababbbbbabaaaaaabbbbbabbabbaaabaaabababbbabbbaaaaaaaaabbaaaababbbaabaaabbaaabbabbabaabbabbbaabbabaabbbbaaabbbaaabbabbbabbabbbbaabaababaaabbbbabbbbbaaaaaaabbabbbbbabbabbbbaaabbaabbbaabbbbaabbbbbbbababaabaaaabbababaaaaabbabaaabaabbaabbbaaabbbbbbaabababbbbbababbbaabbbabaa...

output:

222902

result:

ok single line: '222902'

Subtask #3:

score: 5
Accepted

Test #16:

score: 5
Accepted
time: 330ms
memory: 317192kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

493827

result:

ok single line: '493827'

Subtask #4:

score: 25
Accepted

Test #17:

score: 25
Accepted
time: 76ms
memory: 87224kb

input:

bbbbbbbbbaabbbbbabaaabaabaaabaaaaabaaaabbbbbbbaaaabaabbbababbaaaabbabababbbabbbbabbabaabaaabbabbaaababaaabaaaabababbbbbbbaabbaaabbabbbbbabbbaaaaababbbaaabaabababbabbabababbabbabaaaaabaaaaaabbbabaabbbaaaabbabababaaababaabbbbbbbaaabbbabaabaaaabaabaababbaaaabababaabbbaaaababaaababbbbbbabbbbbbaabbabbaaa...

output:

43524

result:

ok single line: '43524'

Test #18:

score: 25
Accepted
time: 74ms
memory: 112960kb

input:

baaaabbbabbbbabbbbabbbabbbbbabbbabbaabbbbbbabbabaabbbbbbbbbbbbaabbbbbaaabaaabbbbbaabbbbbbbbbbbbbababbbbabbbbbbbbbbbbbbbbabbbbbbbbabbbbabbbbaabaabbbabbbabbbaabbbbbabbbbbbaaabbbbbbaaabbaaabbabbabbbbbaabbbbbabbabababbbbbbbbbbbbabbbbaabbbbabbbbbbbbbbbbbbbabbbbbabbabbabababbbabbbbaabbabbbbbbbbaabbaabbbbb...

output:

107148

result:

ok single line: '107148'

Test #19:

score: 25
Accepted
time: 93ms
memory: 124300kb

input:

bbbbbabbbbbabbbbbbbbbbbbbbbbbbaaabbbbbbabbbbbbbaababbbbbbbbbbbabbbbbababbaabbbbbbbbbbbbbbbbbbabbbbabbbbbbbbaabbbbabbbbbbbbaabbbbbbbbbbbbbbbbbbbbbbabbbbbbaaabbabbbbbbabbbbbbabbbabbabbbbabbbbbbbbbbbbbabbbbbabbbbbbbbbbbbababbbbbbbbbbababbbabbabbbabbbabbabbbbabbababbbbbbbbbbbbbababbbbbabbbabbbbabbbbbbab...

output:

84043

result:

ok single line: '84043'

Test #20:

score: 25
Accepted
time: 91ms
memory: 123756kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

3

result:

ok single line: '3'

Test #21:

score: 25
Accepted
time: 88ms
memory: 125820kb

input:

bbbbbbbbbbbbbbbbabbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbabbabbbbbbbbbbbbbbbbbb...

output:

142965

result:

ok single line: '142965'

Test #22:

score: 25
Accepted
time: 104ms
memory: 121988kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

5

result:

ok single line: '5'

Test #23:

score: 25
Accepted
time: 92ms
memory: 127260kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

99972

result:

ok single line: '99972'

Test #24:

score: 25
Accepted
time: 75ms
memory: 100300kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

99997

result:

ok single line: '99997'

Test #25:

score: 25
Accepted
time: 83ms
memory: 116532kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

99999

result:

ok single line: '99999'

Test #26:

score: 25
Accepted
time: 93ms
memory: 124620kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

130005

result:

ok single line: '130005'

Test #27:

score: 25
Accepted
time: 77ms
memory: 90536kb

input:

baabbaabaaabbaaaababaabbaabbabaabaaaabaaaaababaaabaabbbbaabbaabaaaabaabaaaaabaabbabaaaaabbaaabaaababbbbbabbbbbbbbabbbbbbbbabbaaabaabaaaabaaaabbbbbaaabaaaaaaabaaabbbaaabbbbbaaabbaaaababaabbbbaabaaabbbbaababaaabaaabbababbbababbabaaaaabaaababbaaabbbabababaababaabbababaaaabbababaababbbbbbaabbaabababbaab...

output:

67291

result:

ok single line: '67291'

Test #28:

score: 25
Accepted
time: 95ms
memory: 122000kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

3

result:

ok single line: '3'

Subtask #5:

score: 25
Accepted

Dependency #1:

100%
Accepted

Dependency #4:

100%
Accepted

Test #29:

score: 25
Accepted
time: 218ms
memory: 163928kb

input:

aabbbaaaaaaaababaabaaaabbbbabababbaaaaaabaabbabbbaaabbaaabbaaaabbabaabaaababbbaaaabbababbabbaabbbbaabaaabbaabababaaaabbbbbabbbaaaaaabbbbabbaaababbaaabaaaabaaaaaaabbbaababaabababaabbabaababababaabbaabaaabababbbbabbbaaabbbbaabaaaabaaaaaababbababbaabbabaababbababbabbbbabbaabbabbbbbbbbaabaabbbbbbbbbbbba...

output:

72979

result:

ok single line: '72979'

Test #30:

score: 25
Accepted
time: 269ms
memory: 212816kb

input:

fefddeecdbffabadeeccbafdcfcabfacbfdbadccbcaebecdfeaaaebaacddcbacefacfcfdccfcecaabaebaeebeadddcfbaecdcaeebfbdeaecfdabcbdeabecbdbcdcdebedaaffacffbbedacefbffecfffebeebbfadabbfcafdbcedadbcddfbdedabbdafcacbafaeccaabbbbffceaebeebeeaffbdbfdceffdcdfdefdbedfdcddacefeafbcbaedbfefbaddeaecbcbfdaaacfdabeeacaaeea...

output:

68728

result:

ok single line: '68728'

Test #31:

score: 25
Accepted
time: 239ms
memory: 205472kb

input:

agahaiaaafagaeagagadajaaaeagagaiacacaeagaeafajajajajacafahaiagaeabaiaiaaagadaeabahacadafajagajahafacaaafadaiahahajajajaeagabahahahaeaaacahahaaafagababaeaeacagaiabacagaaaaaaafadaaajadafacagaaajaiahaiaaacabajaiagaiagacahadabahaaaeaeababadadaaaeaeacaeadaiaeaeagagadaaaiadabaiagaaaaaiajahahagacaeahahahaa...

output:

272423

result:

ok single line: '272423'

Test #32:

score: 25
Accepted
time: 147ms
memory: 175484kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

250000

result:

ok single line: '250000'

Test #33:

score: 25
Accepted
time: 200ms
memory: 213252kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

249976

result:

ok single line: '249976'

Test #34:

score: 25
Accepted
time: 216ms
memory: 163916kb

input:

abbabababbbaaabbbabbabaaababbabbabbaabbbaabaababbbbaabaabaaabbbbbbaabbbabbbbbabababbbbaababbbbaabaaaaabbbbbbbabbbbabaabaaaababbaabaaaabbbaabbbabbbbaaaaaabbaaaaababbaaabaaaabbaabaabbbabababbababbbbababaaaabbabbbbbbbbbbaaaababababababababaababbbaabbbbbabbbbabbbbbababbabbabbaaaabaaabbababaaabbbabbbbbbb...

output:

106249

result:

ok single line: '106249'

Test #35:

score: 25
Accepted
time: 207ms
memory: 167280kb

input:

abaaabbabbbabbaabbbbbbbabbaababbbabbaabbabaabbabbbbabaababbbbaaaaabbbbbbababbbaabaababaabbbaaababaaaaaaaabaaabaaaaaabaaabbbbabbabbaaabbaabbabbbaabbbbaaabaaaabbaabababbaaabbaaaabbabbbbaabbaaabaaaabbbaabbabbbbaababaabaaaaabbbabbbbababaaabbaabababbaababbabbbbbbabaaaabbbbbaaababbbaaaababaaaaaababaababba...

output:

175546

result:

ok single line: '175546'

Test #36:

score: 25
Accepted
time: 263ms
memory: 185548kb

input:

zksvttiyllprjwwcbhfjhdixsaxlgmolhwqrenaqnhuupvjlloduecabbumzrblxlhrmbiiwsfuyqnxpkqyesjtvvhdxmakdkenackoorbdsaaauhdnyjtpvunfnhjxgexufgcmlofvybcaoaisoofrgcypcaaxtbvwhlkilgryxblkpnprmpnjekybsnwngnudeohozwjdgwnifuxogrkszgjebmanxcvbjfpetcnytapxkmqdoivsqzpfxhckmsosohwtcvdubnfjyydagtarffsmnmjszjyskysyrudrl...

output:

12409

result:

ok single line: '12409'

Test #37:

score: 25
Accepted
time: 262ms
memory: 192584kb

input:

ifcjrrilczgpvwvcryxjygnifpgmkvpzqqapttabzfzcgooybkcnfwtqmjynftxlbqqtsnwcmdrfvpvxhppqwvipewfabeyplslxlplhkrvtyqejmrrwrfxpxwnqynafskbrulumilnsvtnwfmzlvwcmtlsnsidgqwknknlpwpvdurazgajldygvijqpdmkjuygdbhduzopepwbovtggvpvegyhdlenyglmrpdfaolqiseowiqeqsbtuedprcezazmyrtudwpilozezxipedcyfnykueyvgghfpzzlcqsues...

output:

3103

result:

ok single line: '3103'

Test #38:

score: 25
Accepted
time: 283ms
memory: 214304kb

input:

bcbefabbbbacdcfccfedddffbdaddbbdfcdbcbaffdcccbdecddbcfdcffbdeafcaffbebfbcaecaceacadafbcedddabfcdeeffeeebeafccfbdebeccbcdbeaebbfeabedecfdfdadafabbadbddffdbabddacebdcbdefbddebeaaceeceedeecddbbcbfcabbaebcceddcedfaababecdbbebadcfaeacfcdaefeeacebcbdeaadaafffebdcaabadebdbebacfecddccdbddffaeafbdaeefaafbcbb...

output:

59712

result:

ok single line: '59712'

Test #39:

score: 25
Accepted
time: 279ms
memory: 213872kb

input:

dfdbdbacddfcbadafcadaabaafcfbfebcaabefecfbbddceccddacefbadfdcefbcbecdbfceaccdaaaefcfdfefecfaecebacfcccbcaeffccbaceaeddcfadaddadbeedbbbfabbefbaddecefaeadcceabeedfeedaedfdbcacecddacedfeecfbcebfbbccecaccaaadeeeebeebeefaeacdafcedbeaccbfcacaefdcddeaeefdabfccadbfbcbeceedddaeaddffdfddafacdfacfeaffdadcbbded...

output:

59161

result:

ok single line: '59161'

Test #40:

score: 25
Accepted
time: 217ms
memory: 222148kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

249976

result:

ok single line: '249976'

Test #41:

score: 25
Accepted
time: 159ms
memory: 175064kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1

result:

ok single line: '1'

Test #42:

score: 25
Accepted
time: 203ms
memory: 167348kb

input:

abbabababbbaaabbbabbabaaababbabbabbaabbbaabaababbbbaabaabaaabbbbbbaabbbabbbbbabababbbbaababbbbaabaaaaabbbbbbbabbbbabaabaaaababbaabaaaabbbaabbbabbbbaaaaaabbaaaaababbaaabaaaabbaabaabbbabababbababbbbababaaaabbabbbbbbbbbbaaaababababababababaababbbaabbbbbabbbbabbbbbababbabbabbaaaabaaabbababaaabbbabbbbbbb...

output:

106249

result:

ok single line: '106249'

Test #43:

score: 25
Accepted
time: 203ms
memory: 213148kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

71

result:

ok single line: '71'

Test #44:

score: 25
Accepted
time: 190ms
memory: 199260kb

input:

caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

75

result:

ok single line: '75'

Test #45:

score: 25
Accepted
time: 164ms
memory: 180136kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

2

result:

ok single line: '2'

Subtask #6:

score: 25
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #5:

100%
Accepted

Test #46:

score: 25
Accepted
time: 571ms
memory: 351632kb

input:

mwwbxfwwayliqflnawfefkmgmwtweyrxobkdiqdleenlncchjgdoonpyekqpklctjirybsftrlewxuyvelkmnprdsdfvzkhatjmamulwfqesxsqjhzoyxceyruxkrpucqcpbqetdnjfslcwdiglgryodhvcwiqrfcrkpvriwdnqkbrdxrqlhjhlhdjlbyhqdnwdsrafqgqpjhtrtkfuetacyzzuitfjstjgiulyxaoneeyspxjyfbvbbqfobidicseztwlwamagvduizgmyscfdumgafhjlbcnmwvtpjkgiz...

output:

3427

result:

ok single line: '3427'

Test #47:

score: 25
Accepted
time: 577ms
memory: 353804kb

input:

jpqxtaollqqmqvnxrznvviaaobvcnzizszcocelshqopokjbydrvsbewxhrqroqlewprxqdmmgetmanzdvmhoosjjypulwqddgsftctcwrfjgzhmsjsnjgizpczenspgmvfqbfxobzlndgveuvbitvrtfofjkexejnxsdmuoydyitdakindsmhjvxcukiwsvlkhjvzomdfcujnlaarlsocbsldjrcoicisxkttaspqhjxayjtvpgberegzscqhtxehkzpxeewpvhskfgmnadspyjdwrpjybztnhxplrwaqwo...

output:

31255

result:

ok single line: '31255'

Test #48:

score: 25
Accepted
time: 474ms
memory: 290912kb

input:

bbabbbaaabbbabaaaabababbabbbbbabbbbbbbbbbbabbbbbabbbaaabbbbaababaabbbbbbbbbbbbbabaabbaaabaababaabaaabbabbbabbbabaabbaabaababbbbbbaaabbbbaaabaabbbabbbabbabaabbbbabbbaabaaaabbbbbabaaaabaabbabaaabbaabbabbaaabbabaaababbababababaabaaaabaabaabaaabaabbbabbbbbaababbabbbabbbbababaaabbabbaaaabbbaaabaabbbaaaaa...

output:

295499

result:

ok single line: '295499'

Test #49:

score: 25
Accepted
time: 477ms
memory: 290788kb

input:

bbaababaaabababbbabbbbbabaaaababababbaababbaaabbabbbababaaaababbbbabbbababbaaaababbbaabaababbabbbaaaabbabbbabbaaaababababaabbbbbbaaababaabaaababaabababbbababbbbabbabaabaaabaaabaaababababaaabbbaaaaabaabbbbbbbababbabababbaabaababaabbbbaaababaabbaaabaabaabbbbaaabababbbaabaaabaaaabaaaaaabaaabaaaabbaaaab...

output:

142897

result:

ok single line: '142897'

Test #50:

score: 25
Accepted
time: 358ms
memory: 327660kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1

result:

ok single line: '1'

Test #51:

score: 25
Accepted
time: 477ms
memory: 289256kb

input:

bbaaabaabababaaababbababaabbaaaabbabbbaabaaabaabaaaabbababbbaaabbaaaabaaabaaabbbabbbbabbaaaaababbbaabbabababaabbabbabbabbaaabbbaababaaabbabbaababaabaaabbbaababbbaaabbaaabbaabaabbababbaababbbbbaabaabababababaaaaabbbbabbabbbbabbbbabbbbabaabbbaabbabbaaaabbabaaabbbababbbaaabaaabbaaabaaabbbaabaaaabaabbaa...

output:

204172

result:

ok single line: '204172'

Test #52:

score: 25
Accepted
time: 604ms
memory: 394236kb

input:

eafebaefcabeaadaeeacecdfdfababaeadfbdaabcfccafcafacfbbdaebaddffaedbadafbbbfafcfbbceeccccbeddaefcddaaacaaaebdefdafadaacdaaebeaefbfaccfdbfaabfffafecacdedfabadafababedabcaabfaedefabfbccafccbacccafcdddaafaeddedadedbbbbfeefcbdabeaefaebeddeebaedadfcacaebcdccaeaeaaaacdcbfbeeeaeddeaaddacdcbfebaddbffddfaabca...

output:

21449

result:

ok single line: '21449'

Test #53:

score: 25
Accepted
time: 597ms
memory: 394904kb

input:

dbddbcffaeeecbdbcbccebcfdcbfeefbfbeffabfcedccbadadeecfbeefabdbacfefaebfbbcbbbeefffaacfeedffbbcfadecaefcddacfbfcbbddeeabeddccbfcaadcdeeaccfafaacaccdebdfcdbdafddcdbfbacfccfdfcedbfdecfebabaaadeddeeacbbbffafabcfceebcbdfaffbcbabdedfefbeddfedbceaedeabaedfecfbbbcaefdcadcceaeafeefaceabfcbadfdaaaaecfffefaaac...

output:

67202

result:

ok single line: '67202'

Test #54:

score: 25
Accepted
time: 442ms
memory: 392460kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

500000

result:

ok single line: '500000'

Test #55:

score: 25
Accepted
time: 472ms
memory: 408508kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

499954

result:

ok single line: '499954'

Test #56:

score: 25
Accepted
time: 478ms
memory: 348400kb

input:

ayaxaiakaeasaiacawakadaqacaqaoauakaeaqazaaamajabazauaradagalanahajaoahadadataqauawasawapabanaaapajahajadabalacadafadaaacaoadajaraqaaaaacaoaxaxajaeakafadapalacahayazadawakamaaafahacavatazacaoasacararacatamaralazaaadajavamamaxacarakauaoarayalakakalaqabafapaxavaaabafabaiajauaoanatarayaoakanaqalayataoap...

output:

500603

result:

ok single line: '500603'

Test #57:

score: 25
Accepted
time: 441ms
memory: 386540kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

499950

result:

ok single line: '499950'

Test #58:

score: 25
Accepted
time: 539ms
memory: 444764kb

input:

acacababababaaacaaacacacaaaaabaaaaacacabacababacabacaaaaababaaacacacacacaaaaacacaaaaaaababaaaaabacaaacacabababaaacacacaaaaacacabacaaacacabacaaaaaaacacabaaababababacacaaaaaaacabacacaaacacacabaaabacaaabaaacabababacacaaacabacabaaabacabacaaabaaacaaacacaaaaabacacabaaacaaacacaaacacabaaacaaabababacaaacacac...

output:

537438

result:

ok single line: '537438'

Test #59:

score: 25
Accepted
time: 210ms
memory: 227416kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

76

result:

ok single line: '76'

Test #60:

score: 25
Accepted
time: 429ms
memory: 393312kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

3

result:

ok single line: '3'