QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#50427#4844. Positive StringYaoBIG#AC ✓155ms15288kbC++173.4kb2022-09-26 00:39:532022-09-26 00:39:56

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-26 00:39:56]
  • 评测
  • 测评结果:AC
  • 用时:155ms
  • 内存:15288kb
  • [2022-09-26 00:39:53]
  • 提交

answer

#include "bits/stdc++.h"
#define rep(i, a, n) for (int i = a; i <= n; ++i)
#define revrep(i, a, n) for (int i = n; i >= a; --i)
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
using namespace std;

string to_string(const string &s) { return '"' + s + '"'; }
template<class A> string to_string(A v) {
	bool first = 1;
	string res = "{";
	for (const auto &x: v) {
		if (!first) res += ", ";
		first = 0;
		res += to_string(x);
	}
	res += "}";
	return res;
}
void debug_out() { cerr << endl; }
template<class H, class... T> void debug_out(H h, T... t) {
	cerr << " " << to_string(h);
	debug_out(t...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

using vi = vector<int>;
using ll = long long;
using pii = pair<int, int>;

struct SA {
	int n;
	vi str, sa, rank, h;

	template<class T> SA(const T &s): n(sz(s)), str(n + 1), sa(n + 1), rank(n + 1), h(n - 1) {
		auto vec = s;
		sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
		rep(i, 0, n - 1) str[i] = rank[i] = lower_bound(all(vec), s[i]) - vec.begin() + 1;
		iota(all(sa), 0);
		n++;

		for (int len = 0; len < n; len = len ? len * 2 : 1) {
			vi cnt(n + 1);
			for (auto v: rank) cnt[v + 1]++;
			rep(i, 1, n - 1) cnt[i] += cnt[i - 1];

			vi nsa(n), nrank(n);

			for (auto pos: sa) {
				pos -= len;
				if (pos < 0) pos += n;
				nsa[cnt[rank[pos]]++] = pos;
			}
			swap(sa, nsa);

			int r = 0, oldp = -1;
			for (auto p: sa) {
				auto next = [&](int a, int b) { return a + b < n ? a + b : a + b - n; };
				if (~oldp) r += (rank[p] != rank[oldp]) || (rank[next(p, len)] != rank[next(oldp, len)]);
				nrank[p] = r;
				oldp = p;
			}
			swap(rank, nrank);
		}
		sa = vi(sa.begin() + 1, sa.end());
		rank.resize(--n);
		rep(i, 0, n - 1) rank[sa[i]] = i;


		int len = 0;
		rep(i, 0, n - 1) {
			if (len) len--;
			int rk = rank[i];
			if (rk == n - 1) continue;
			while (str[i + len] == str[sa[rk + 1] + len]) len++;
			h[rk] = len;
		}
	}
};

template<class T>
vi Manacher(const T &s) {
	int n = sz(s);
	vi len(n * 2 - 1, 1);
	int j = 0;
    rep(i, 1, n * 2 - 2) {
        int p = i / 2, q = i - p, r = (j + 1) / 2 + len[j] - 1;
        len[i] = r < q ? 0 : min(r - q + 1, len[j * 2 - i]);
        while (p > len[i] - 1 && q + len[i] < n && s[p - len[i]] == s[q + len[i]]) len[i]++;
        if (q + len[i] - 1 > r) j = i;
    }
	return len;
}

template<class T>
struct BIT {
	int n;
	vector<T> as;
	BIT(int n): n(n), as(n + 1) {}
	void Add(int i, T val) {
		for (i++; i <= n; i += i & -i) as[i] += val;
	}
	T ask(int i) {
		T res{};
		for (i++; i; i -= i & -i) res += as[i];
		return res;
	}
};


int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	string s; cin >> s;
	int n = sz(s);
	string S = s;
	S += char(127);
	reverse(all(s));
	S += s;
	reverse(all(s));
	s.push_back(127);
	SA suf(S);
	auto &rank = suf.rank;
	BIT<int> bit(n * 2 + 1);
	ll ans = 0;
	revrep(i, 0, n - 1) {
		int pos = rank[i];
		int pos2 = rank[n * 2 - i];
		bit.Add(pos2, 1);
		ans += bit.ask(pos);
	}
	auto rads = Manacher(s);
	rep(i, 0, n - 1) {
		int r = rads[i * 2];
		int ed = s[i + r];
		int st = i - r < 0 ? -1 : s[i - r];
		if (st < ed) ans -= r;
	}
	rep(i, 0, n - 2) {
		int r = rads[i * 2 + 1];
		if (r == 0) continue;
		int ed = s[i + 1 + r];
		int st = i - r < 0 ? -1 : s[i - r];
		if (st < ed) ans -= r;
	}
	printf("%lld\n", ans);
	return 0;
}

详细

Test #1:

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

input:

jjikkollp

output:

4

result:

ok 1 number(s): "4"

Test #2:

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

input:

pbpbppb

output:

7

result:

ok 1 number(s): "7"

Test #3:

score: 0
Accepted
time: 155ms
memory: 15112kb

input:

tttbdckvkpisriwezmudlrwfkzxjtwrkhxmpqtfunhombmpqygpibgjvnyrjzvnkvwcsgtcdifujfqanmrvwkuxhgtntanazgeaermjdlrcbppwxsrdykkyxalfxsgjyktafbyrnlekwwbfsxbnwjfkkmwtcnytkbqqlfxxxfiomtsvyefkiojehqmvezcprdsxafpxjuvxcbwyjuugzcoszeuqzupgzwrykubltkeyiqdegtrtjxrjadqbngrktaflcatkuhofycrtxpaacfmtwmtheagxwynmibnrpwoej...

output:

9987275747

result:

ok 1 number(s): "9987275747"

Test #4:

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

input:

a

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 0
Accepted
time: 75ms
memory: 15176kb

input:

dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

0

result:

ok 1 number(s): "0"

Test #6:

score: 0
Accepted
time: 102ms
memory: 15168kb

input:

cccccccccccccccccccccccccccccccccccccccccccccccccxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccocccccccccccccccccccccccccccccccccccccccccccccxcccccccccccjcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc...

output:

10020572944

result:

ok 1 number(s): "10020572944"

Test #7:

score: 0
Accepted
time: 97ms
memory: 15180kb

input:

ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttjttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttetttttttttttttttttt...

output:

10270918647

result:

ok 1 number(s): "10270918647"

Test #8:

score: 0
Accepted
time: 46ms
memory: 9320kb

input:

ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooocoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

2531342670

result:

ok 1 number(s): "2531342670"

Test #9:

score: 0
Accepted
time: 67ms
memory: 15100kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok 1 number(s): "0"

Test #10:

score: 0
Accepted
time: 72ms
memory: 15096kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok 1 number(s): "0"

Test #11:

score: 0
Accepted
time: 40ms
memory: 9260kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: 0
Accepted
time: 72ms
memory: 15172kb

input:

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

19230655235

result:

ok 1 number(s): "19230655235"

Test #13:

score: 0
Accepted
time: 58ms
memory: 15192kb

input:

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

19230527746

result:

ok 1 number(s): "19230527746"

Test #14:

score: 0
Accepted
time: 36ms
memory: 9248kb

input:

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

4807659003

result:

ok 1 number(s): "4807659003"

Test #15:

score: 0
Accepted
time: 86ms
memory: 15256kb

input:

aaaaaaaaaaeataagaaaaaaaaaaualapaaaaagaaaaaafamaaaaaaaalaaaaaaaaaaaaaiaapagaaaxaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaafaaaayavayaaaiaiaaaoaaaaaaaeaaaaaauaaaaaaaaaaaauahayaaaaaaaaaaaaxaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaauaaaaaaaanaaanaaahaaaaaaaaaaaaaaaaaajaaanaaaaaaaaqaraaaaaaaaaaaaaaaaaaca...

output:

2289060770

result:

ok 1 number(s): "2289060770"

Test #16:

score: 0
Accepted
time: 68ms
memory: 15116kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

447195772

result:

ok 1 number(s): "447195772"

Test #17:

score: 0
Accepted
time: 33ms
memory: 9336kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaqaaaaaaaaaaaaaaaaaaaaaaaraaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

145781946

result:

ok 1 number(s): "145781946"

Test #18:

score: 0
Accepted
time: 94ms
memory: 15188kb

input:

zzzzzzzzzzzzuztzzzzzzzzzzwzzczzzzzczzzzzzzzzzzzwzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzgzzzzzizzzzzzlzzzzzzzzzzzzzzzzwzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzkzzzzizzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzzzzzzzezzzzzvzzzzzizzzzzzzzzzzzzzmzzzzfzrzzzzzbuzzzzzzzzzz...

output:

18409032362

result:

ok 1 number(s): "18409032362"

Test #19:

score: 0
Accepted
time: 77ms
memory: 15080kb

input:

zzzzgzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzwzzzzzgzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzdzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

19438576443

result:

ok 1 number(s): "19438576443"

Test #20:

score: 0
Accepted
time: 47ms
memory: 9324kb

input:

zzzszzzznzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzznzzzjzzzzpzwzzzzzzzzzzzzzzzzzzzzzzwzzzzzzzzzzzezzzzkzzzzzbzzzzzzzzzzzzzzzzzzzzzzzzzzzzzczzzzzzzzzzzfmzzczzzzsmzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzjzzzzzzzzzzzzzzwzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzvzzzzelz...

output:

4680731829

result:

ok 1 number(s): "4680731829"

Test #21:

score: 0
Accepted
time: 129ms
memory: 15256kb

input:

pacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszgvznkscappacsknzvgzskpqcxdaivkhhkviadxcqpkszg...

output:

9973238297

result:

ok 1 number(s): "9973238297"

Test #22:

score: 0
Accepted
time: 121ms
memory: 15176kb

input:

oaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseaooaeszxkfsyqlxiavjaehbvsyvfzunkknuzfvysvbheajvaixlqysfkxzseao...

output:

9973273540

result:

ok 1 number(s): "9973273540"

Test #23:

score: 0
Accepted
time: 54ms
memory: 9316kb

input:

zzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyypyawscjcbalvyjanyekkeynajyvlabcjcswaypyyiqjewqzzzzqwejqiyy...

output:

2486021051

result:

ok 1 number(s): "2486021051"

Test #24:

score: 0
Accepted
time: 60ms
memory: 15176kb

input:

cnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnccnnc...

output:

9439930932

result:

ok 1 number(s): "9439930932"

Test #25:

score: 0
Accepted
time: 77ms
memory: 15288kb

input:

oyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryooyrzddzryo...

output:

9704207014

result:

ok 1 number(s): "9704207014"

Test #26:

score: 0
Accepted
time: 36ms
memory: 9392kb

input:

tuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihuttuhivvihut...

output:

2431144645

result:

ok 1 number(s): "2431144645"

Test #27:

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

input:

ultejuinafygvtkglxcpwbwqonryoocxlvyraiisvmonhhkqwrnhtkwfwwoglvywbslptaspzyaaecemiprcithpmlobcxnajbhpmofqkelnknjtoqklrocwlkgtkzlvvpqrqjbxhevdhcdcadwmtkmimzpcbhynttydoyxjdlehnfsnuegnzwchipqbtgfutlasedxgpyprxbkghrkfnqwohhicjgrqyuvqsylxethjevtiofztjfhpmvjgmlixpvmprkizxglesjlohjzrarusfutrzbokqowzfdrxxwnu...

output:

25310346

result:

ok 1 number(s): "25310346"

Test #28:

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

input:

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...

output:

0

result:

ok 1 number(s): "0"

Test #29:

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

input:

nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnn...

output:

25496433

result:

ok 1 number(s): "25496433"

Test #30:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok 1 number(s): "0"

Test #31:

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

input:

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

48074404

result:

ok 1 number(s): "48074404"

Test #32:

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

input:

aaaaaaaaaaaaagaaaaaaaaaaaaaaaaaaaeaagkaaakaqaaaaaaaaaaaaaaaaaaaaeaaaaaaaajaaaeaaaaaaaapaaaoaaaaalaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaauaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaasaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaawaaaaaaaaaaaaaaaaaaaaaaaaaaaaahaaaaaaaaaaauaaaaaaaaaaaaaaacaaaaaaauaa...

output:

2831203

result:

ok 1 number(s): "2831203"

Test #33:

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

input:

zzzzzzzzzzzzzzzyzzzzzzzzzzzzzzzzzzzzjzzzzzzzzzzzzzzzzzzzzzzzzzbzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzfzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzqzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzvzzz...

output:

47656154

result:

ok 1 number(s): "47656154"

Test #34:

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

input:

dqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqddqeybhneaaggaaejsbukuihukkuhxxxxhukkuhiukubsjeaaggaaenhbyeqd...

output:

24694861

result:

ok 1 number(s): "24694861"

Test #35:

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

input:

xbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbxxbzzbx...

output:

24694646

result:

ok 1 number(s): "24694646"