QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#200286#7345. Circular ShiftTeam_name#AC ✓150ms161164kbC++201.9kb2023-10-04 16:14:322023-10-04 16:14:38

Judging History

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

  • [2023-10-04 16:14:38]
  • 评测
  • 测评结果:AC
  • 用时:150ms
  • 内存:161164kb
  • [2023-10-04 16:14:32]
  • 提交

answer

#include <bits/stdc++.h>

#define endl '\n'
#define DEBUG_VAR(x) { cerr << "* "#x" = " << x << endl; }
#define DEBUG_FMT(...) { cerr << "* "; fprintf(stderr, __VA_ARGS__); }

using namespace std;
using LL = long long;

const int N = 3e5+5;

struct Node
{
	int len, fa;
	int ch[26];
}t[3*N];

int tot = 1, las = 1;
int endpos[3*N];

void extend(int c)
{
	int p = las, np = las = ++tot;
	t[np].len = t[p].len+1;
	for(; p && !t[p].ch[c]; p = t[p].fa) 
		t[p].ch[c] = np;

	if(!p) t[np].fa = 1;
	else {
		int q = t[p].ch[c];
		if(t[q].len == t[p].len+1) t[np].fa = q;
		else {
			int nq = ++tot;
			t[nq] = t[q]; t[nq].len = t[p].len+1;
			t[q].fa = t[np].fa = nq;
			for(; p && t[p].ch[c] == q; p = t[p].fa) 
				t[p].ch[c] = nq;
		}
	}
}

int n;

char str[N];
int s[N][26];

vector<int> e[3*N];

LL ans = 0;
void dfs(int x)
{
	for(int y : e[x]) {
		dfs(y);
		if(!endpos[x]) 
			endpos[x] = endpos[y];
	}

	if(x == 1) return;
	int l = endpos[x]-t[x].len+1, r = endpos[x]-t[t[x].fa].len;
	// if(r == endpos[x]) r--;
	for(int i = 0; i < 26; i++) {
		if(!t[x].ch[i]) continue;
		int delta = s[r-1][i]-s[l-1][i];
		if(delta <= 0) continue;
		ans += delta;
		// DEBUG_FMT("endpos = %d, char = %c, [%d, %d], +%d\n", endpos[x], 'a'+i, l, r, delta);
	}
	int c = str[r]-'a';
	if(t[t[x].fa].ch[c]) {
		ans++;
	}	
}

int main()
{
	// freopen("1.in", "r", stdin);

	scanf(" %s", str+1);
	n = strlen(str+1);

	for(int i = 1; i <= n; i++) {
		int c = str[i]-'a';
		extend(c);
		memcpy(s[i], s[i-1], sizeof s[i]);
		s[i][c]++;
	}

	int cur = 1;
	for(int i = 1; i <= n; i++) {
		int c = str[i]-'a';
		cur = t[cur].ch[c];
		endpos[cur] = i;
	}

	for(int i = tot; i > 1; i--) {
		int y = t[i].fa;
		e[y].push_back(i);
	}

	dfs(1);

	// for(int i = 0; i < 26; i++) 
	// 	if(s[n][i]) ans++;

	cout << ans << endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 28404kb

input:

abaac

output:

7

result:

ok 1 number(s): "7"

Test #2:

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

input:

aaa

output:

3

result:

ok 1 number(s): "3"

Test #3:

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

input:

a

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

z

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

aa

output:

2

result:

ok 1 number(s): "2"

Test #6:

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

input:

az

output:

2

result:

ok 1 number(s): "2"

Test #7:

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

input:

za

output:

2

result:

ok 1 number(s): "2"

Test #8:

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

input:

zz

output:

2

result:

ok 1 number(s): "2"

Test #9:

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

input:

abc

output:

3

result:

ok 1 number(s): "3"

Test #10:

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

input:

aab

output:

3

result:

ok 1 number(s): "3"

Test #11:

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

input:

baa

output:

3

result:

ok 1 number(s): "3"

Test #12:

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

input:

dbda

output:

5

result:

ok 1 number(s): "5"

Test #13:

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

input:

dacc

output:

4

result:

ok 1 number(s): "4"

Test #14:

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

input:

cdaca

output:

6

result:

ok 1 number(s): "6"

Test #15:

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

input:

cddcc

output:

8

result:

ok 1 number(s): "8"

Test #16:

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

input:

adcbdb

output:

7

result:

ok 1 number(s): "7"

Test #17:

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

input:

cccccc

output:

6

result:

ok 1 number(s): "6"

Test #18:

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

input:

ccdcabb

output:

9

result:

ok 1 number(s): "9"

Test #19:

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

input:

bcbddca

output:

8

result:

ok 1 number(s): "8"

Test #20:

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

input:

cadababb

output:

11

result:

ok 1 number(s): "11"

Test #21:

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

input:

bdddcbbc

output:

11

result:

ok 1 number(s): "11"

Test #22:

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

input:

acdaabcdb

output:

10

result:

ok 1 number(s): "10"

Test #23:

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

input:

abcabdcad

output:

11

result:

ok 1 number(s): "11"

Test #24:

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

input:

bccbccccda

output:

17

result:

ok 1 number(s): "17"

Test #25:

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

input:

bbdddadcab

output:

14

result:

ok 1 number(s): "14"

Test #26:

score: 0
Accepted
time: 44ms
memory: 127624kb

input:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

300000

result:

ok 1 number(s): "300000"

Test #27:

score: 0
Accepted
time: 22ms
memory: 129688kb

input:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

300000

result:

ok 1 number(s): "300000"

Test #28:

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

input:

yxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

300000

result:

ok 1 number(s): "300000"

Test #29:

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

input:

abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn...

output:

299988

result:

ok 1 number(s): "299988"

Test #30:

score: 0
Accepted
time: 49ms
memory: 122836kb

input:

cacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacacaca...

output:

5625225001

result:

ok 1 number(s): "5625225001"

Test #31:

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

input:

acaacacbcacabbaaabbbbcbaabcccabbbabaabbbccaabcbbbcaabbbbcbbcaacabaccbbacbaccacbbbabaccbaabbbccaaccbcbbaabbccccca

output:

2024

result:

ok 1 number(s): "2024"

Test #32:

score: 0
Accepted
time: 12ms
memory: 42196kb

input:

babbaccacaaababacacbaccabcaaacbcacaaababaababbbcbccbcccabcabbbacbbbbccccbcaccbbccbbaaacacaacbbabccccaabcbbabaabbaaccababaccaacabcacbccacccbaaabaacbcabbcabacbaacbabcaabcbcabacbaacacaabccbabbabbabacbacaccaccccacbcbcbbabbbaabcaabacbbacacbbccccaaaaacaacbccbbacbacabcaccccccbcacaacccccbcbcbbaacaabcaabbbcb...

output:

365780747

result:

ok 1 number(s): "365780747"

Test #33:

score: 0
Accepted
time: 35ms
memory: 58748kb

input:

abbcbcaabaaaabacbcbbcabababaabcbbbacbbabcbcccbacaaaaacaccaabcbcccababbaabccaaabbcaaccccbbbbcbaccabcabcbbcacaacababbcbacbccacccababbabacbcacccbcbbbbacbbabaaabaabcaaccbbcabbbccabbcbabaaaccabbaccabaccbbaacbaabbbacaaacabaaccabcabbbabaaaacabababbaaabcaacbbbbbcabccaccabaacbcbaaaaaabbbbcacabccabacacbbacbba...

output:

1252345802

result:

ok 1 number(s): "1252345802"

Test #34:

score: 0
Accepted
time: 37ms
memory: 61064kb

input:

bcccccbcacaccccccbcaaccaacccabbbbbbaaacccacbccbbabaacbabbaaabbcbcababcbaacbacbababccabbaccabcccbbacabaaccacccbcaacaccccaacccaaccccacbbaaaabcbbcbcabbbbbabbabacbbcacbccabaacbacbaaccbbbacccccbcbaabcccabbccbcbbaccacbcabbcacbbbccbbcabcacccaacaacccbabbbabccabacaabbaaabcccaabccaaaacbccbabbcbacbbbcbcabcbacc...

output:

1554129143

result:

ok 1 number(s): "1554129143"

Test #35:

score: 0
Accepted
time: 55ms
memory: 71736kb

input:

abcccabcbcaccbaacbbcacbabbababaabcabbbbbccacbcaacabccabcaabbbcaaaaabcccaacabbbbcbabccbbbbccbabccaaacacbabbbbbababcacbabbacbccbbababcabbcabccaaacccbbcabbcaabbcbacabbcbaacacbbbcbcbbbbccbccbcbaabaaccbcccbbcabcaababbababcacbbaabbbcccbcbabbcacabbccbcacaabcabacbabcbaacbcaaaccccaccbccbabaabbccbcbacaababbbb...

output:

3010750398

result:

ok 1 number(s): "3010750398"

Test #36:

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

input:

bcccaabcabaaacbbbcacbccbaccccaabaaaacccacccaabbaabacbaaacbccabcaccaccaccbacabbcaccccaacabccabaaacbbcaacacbccaccccccababcabbaaacbabbccbcbbcaabccbabbcbccbccccacbaacbbccaaababcbcabccaaccbbbbaccbcbbacbcbccaaaaaccaccacbccbaccaaaacacabaabcbcacccaaaccccaaccbcaaccccbabbccbbbbcacaaaabacabbbacaaabccbcbbbbcbbc...

output:

4888615152

result:

ok 1 number(s): "4888615152"

Test #37:

score: 0
Accepted
time: 93ms
memory: 87740kb

input:

caccbbbcbbaacccbbbabacabbabcacabbcbcbcaacbabcbbbacbcaaabaaaccbaaaacaaacabaabacaabbbacaabbcabaaaccaacaaaaaccababbabbacccbacbaabcbcaaccccaabbaabbccacbabcbaacabbbaaabcccacaabccbcbcbaacaabcbccccbbabcbbbcbabbbbcbacaaacbbaaaaaabacaaabaccbbbcabbabcaccbacabbcabbbacaccacbaabbacccbcacbaaacaababacababbabbcaaab...

output:

5976402426

result:

ok 1 number(s): "5976402426"

Test #38:

score: 0
Accepted
time: 101ms
memory: 97932kb

input:

bcbaccacccbbabbaccbabcabacbabacbcbbcccacccbaccbababbbbcaabcbaaabcbcbbacbbaaababbbbcbcacbacbbaaaabbccbbbcaabbaaacbbccbbaaaccacaabcaccbacaacccbabaaababbaabbcabbcaabcbbbcaccacccacaacabcbbbaabcabbbccbbbbaaccaabcbbbbcbbcacbbcbbaabcbccbbaacbbbcacabacaacbcbbabbacbbaccbabccaacaaccbbcbaabbaacaacbbaccbbabbbcb...

output:

7791334008

result:

ok 1 number(s): "7791334008"

Test #39:

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

input:

bbacaaababcaabacbbbbcbcbbacacabaabcbaaaabbcacaaaabbaccbaabbacbacbabbaccacbccccccacbbccacbbccbabbaacccbaabbaabbabbccccaaacbaccbccacbcbcbabbcccccbbcbcaaaacbbbaccbabacbbbaabaccbccbccaccbbbacaacabbccaabcbcacbbccaaabacabababcccaaabccaacbbbbbaaccaaccbacaabbbbcbbacbaccbcabccccbababbacbabcbcaaacaacacccccbac...

output:

10385658005

result:

ok 1 number(s): "10385658005"

Test #40:

score: 0
Accepted
time: 140ms
memory: 120292kb

input:

cabcabacaccbbccbaabbabbaaaababcbbbcbcaaaabccabccacbcbcbacccbbccbbcbccbaacacbbccaabcbabaaccbcbacccccbabccacbbcbacbabccbbcccabcbacbcaaababcaaaabcccaaccacbccccccccbcbbccabbabcbaabacacaaaaacbbbccbcbbacabaaababaccbcbcccabcaacbbccbaccaabccbcacbacccaabcbccabbbbcaacccacaaaacababcbbbcacccacaacbbcabaacccbbcca...

output:

13185061526

result:

ok 1 number(s): "13185061526"

Test #41:

score: 0
Accepted
time: 150ms
memory: 122136kb

input:

cbcabaabcabcabbabcaaababccabcacbaccbacaaacbbaaabaaaabacccbcaacccaabababaccbcbbabbbabcbbbcbaaccaababaccababbacaacabbccbbcbcccbabaacacaabaccbcbbbacbbaaaaccaaabcabacabcbbacbacbbcccbcbcbacaacbacabbcaacbbbacaaaabababcbbcbbbbbcccabccbbbbbbccbaaabcaaababbbcaabcabaaccbacccaacbaababbbacacacbccacabaacabaaccaa...

output:

14999060148

result:

ok 1 number(s): "14999060148"

Test #42:

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

input:

hheggdefeghbecgebacfegbecgfhfcgbdhgedchffaffbfceagagfddhfdgabhggecafdghhbhhchbebhgfcbcfcdgadheagbhfbfffaggeedffchfbdbceafffahhdfgdhhaeaabgbdgcdfbggdheaagdacffgbfdebaehheefhdbgbhbedfhfgbhabdhfahcabadhdgaebfaaagaggbeahacdhdfgchbggbgddbgcfchcghgdcdbddhfeahbfbhhhhbehfagdgdgehggaccheggeeeagcfeaagedcdbgga...

output:

30153449

result:

ok 1 number(s): "30153449"

Test #43:

score: 0
Accepted
time: 22ms
memory: 45372kb

input:

aagafaffcecgeeechbdhgafdaffadedeefghaacdegccabhhhfabcfachbeabcehbcfddgcebbhbehhhcgbhbgaecghfgdaaadhdfbeadfdhggeecedhdfbeaechhcgcbefhhcbdhgfcdgaccfgceegggccgfhaddfhgggdhaddbccbafaahbbaebaeeddfabbcchbbddcebgagbgahbadecgdbhhbgcdddfehefebghacehecgdabbbaabdbfbeabhgeffgafaehcebgddeeegfhcccafchhagbadadhdbb...

output:

203976827

result:

ok 1 number(s): "203976827"

Test #44:

score: 0
Accepted
time: 25ms
memory: 55412kb

input:

dbbddcdahdabdgfdcfbbcfgdcabgcedfeagedgddbefhhghhafdaaddfaaabebcbcdbdbgfbeebdccbafaffhdeecgdahbfdbhggcdaeahdgaehhdfcbadhfhegccbeahadcfcabhaggabgbdfgebhhadeddeabaeefehfabhebehbfbeabadaaddcfbaadfcbbhhgachaabgcgcbcfahdeffbbghgdfchghhedadhgffhadgdcedggggbfaghceecfdhbhadafaabdfaebecdhhcdceaaebdabbagbchfha...

output:

501171381

result:

ok 1 number(s): "501171381"

Test #45:

score: 0
Accepted
time: 34ms
memory: 57640kb

input:

ecdfghcdcfddgehbhaehggfbfgechhaadebbbhhedheehabceebabeddabbdabcaebfbghafcbgedahbbdgfbefagadcecbaedaccchfaacdchedhdgchahecbbhffafbaechhcagdagaeacfahbbgfbebfbfgdeghdaghhfcebbcfehgcagfbdbfhefhhcccfbagaaeahbfcgecbdgebhgfafhgafadggbegeeffeebcgdfegbgbadhfghfcfffaefbgbefgfahbbfdchdaccgeadfghhggadchahddabbb...

output:

737411855

result:

ok 1 number(s): "737411855"

Test #46:

score: 0
Accepted
time: 30ms
memory: 63924kb

input:

hbddbbhefahedgdadechegfdcahaaffechedfbghfhfefeeedegghhacfecahaedahgeghbaahbcefhafbbhegcahaeacchgdcghchfacdghcbadbfbadbachcefadffgcdcfhacgfhbbcdhehhgefhfdfbeeecehdacdgfhecfgddcfcgfdfggafeebfecddffhfefcgghbhdcahahbefbcdcchbebdaaccaghcgceebbbhgdhbcdfgahadfhadachhgfbahbhfcdghddfgahdhafabecebgfgbhheccgaa...

output:

911249835

result:

ok 1 number(s): "911249835"

Test #47:

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

input:

hbfgdhhdghbbdbgfbgeaffaadehhfgbcbcgfcadafcgdgbfahbdbdbadbbahabfcaafhecdgagbdbacbffedcfdgcdghcabghdfgedbhdegehahbdadgbdbadbgegdaadggceagcgahgcaceahdfdcadchagdcfbdcabcbcdfcegacaeachadddhfddhdfebddgedhedgdebccfcgddhhegebgcgaegbddbbhfedfegedhgahggdechhbbbcbfchcfcbfegbbabdbadddhfdfbgccebhfbdgaaafhaehbaeh...

output:

1640841656

result:

ok 1 number(s): "1640841656"

Test #48:

score: 0
Accepted
time: 78ms
memory: 86928kb

input:

bghggchdfcdhffffccdfdbfffdffcacaccbcdgdfcfdacaedhabeahdgggdbgcceegbhffdcbbbchghgebffhcaehgdfgffabgbcechhbgdefhfbebfdaebhbdbdaaacbffchfbcfcdgafeegdhdcegddadfbaaedhgaadehdcgdfcaeafhcdeagcghehaahcadhebhbbaeedchbaehheahcchhcbcagbhafacaabdecgahfdegchefacagheggeccfdeggebhbhdddhebdhfcedgdbchehhdehhfhfffhed...

output:

2707534869

result:

ok 1 number(s): "2707534869"

Test #49:

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

input:

aecgdbadegdbhdafeeefagaccehdfcbgghfggfhbfeacggchhegcdcdfcddfcheeggddfaaebeagfbbgaeahdachfcdhfcfhhbfghcghgecbedghdccfgdhfdaebgehebhcbhafabcadacefacdbbacggbcbfgfaefeacghahgabdccbcfbhgacdachgdccfagddgfcgfehhgfccbbgdebfgfgbgdfdabcfdhchfbdbhdhgafghhhfecgahchdhahghdabfddhdfhfdachadgcacchfcgeffbcdahaaggbba...

output:

2884360929

result:

ok 1 number(s): "2884360929"

Test #50:

score: 0
Accepted
time: 105ms
memory: 101960kb

input:

fbbaebheghacgdehgcbgcefechdhdhgaeahebhcbefcfdbfccagffheefacfhgabegaafafgeageccgahbbdfhbcdhbeggcbdhgabffgaffdgahcaeehhbadhabgbabfdgedaaefaggbgdgbbbacdheedbbhcdgebgbcfdadhhbdahhgaedhcfcggcchchaedafgehcfcebdgfhdhefgcdfdfagfhdgfdabhddcfabbdbhhfchhbbeaaacaegfeefaddagbbfehgfdefafehceecahhdgghddbcfhhccfbdd...

output:

4038141890

result:

ok 1 number(s): "4038141890"

Test #51:

score: 0
Accepted
time: 131ms
memory: 108296kb

input:

degfdbfaghagdhcggcbeeefeaeebbacbaaeggbhfeehfghheeacbedghhhfcbefahgfcehghddaaeedfhgdgcbdhfafchfheacbheebbchgdhghbebedggfchcgabaecebbdggheggcecfbghagehabhbhggheaacdbhddhbhhcbbfgffhcchcedheeedfaagdahddgcbcbfdcegbfhdbgcfcdcgfcbcffcccadfdeacgabcgebcdbagaceagacbcacgbedgddahfhadcchgfhddaghbggbfaaahhgchcddg...

output:

5052356122

result:

ok 1 number(s): "5052356122"

Test #52:

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

input:

egeacacfhbbgfcbfegggfcbcfdbfhdgadgahaggfagghcheedafgdadbdbbgeccgagaeggbccfggaebcaecceaefeffahgfhabhhabafgadcaafgdedfhfcdhhafhhcdahhhdgdgeeagcdadeedaecfdgbdaccacghdhddcachbgaacgfffbbeahfhaachcaccfdefbbachahfebccccdheghcfgcafeebhahfegghedaghdbbdhabgahdfcbaccgbdeehbgfcdahffecbhchcdbbhdaefbfbaedebgfhdcd...

output:

5625012518

result:

ok 1 number(s): "5625012518"

Test #53:

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

input:

ptjlikjjjoiootlnnnqqplimrslttmisooqomkkqlprkktoqqtmoprolmsillikkjptisnrnnqtoopqkmnsminmoommptospipnppltqiqoqrlkikpsrjooktipinrorsommnpqslqjnlmtqstmpsikokjikjpnjqlstslojppsnmitqtomqtsnpqlqjntiokkiliomtiktpjmpmstojmkrtmtinsinrtitonipmrqrrqikkttrsopjmprsrjmqmqnrkmrrslkqjlrnijjpotrokjqtkjsqriqlqrjoprtrq...

output:

25612936

result:

ok 1 number(s): "25612936"

Test #54:

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

input:

rmomrinpqijntispkjokrnklttrjkotktoskjpjqmtrilkqjiikijmirinnlqpqmktpsppkrqnlrtsnqjqroksrjoqkrlijiktrpsqqrnokmonmporllkqspjksstntpisinmtprrqismsolstlisinomrrjiprnqmtjipirislnrkomkotllrmplsrpsjmjjrpjkqoqrqmlnminkkjrtrssprmjnisjmimloljtrrtpqmqtjksliiqsioimnpnkitsrqmkjpolrplprlirimkrqjjtsslqlsqqjmnmliqkk...

output:

64584265

result:

ok 1 number(s): "64584265"

Test #55:

score: 0
Accepted
time: 26ms
memory: 49024kb

input:

irippnmqtikjmqlspkoqjtqnqmiimpkrtijnlljkmqjrspoisqninisjkkjsmmltirsnkmkriqmrtqrmnomrqlsmnjpjtkokpjrltppntmkitproiijsmkikrslnsptilspioosjikrttirslsoiilpknlntlmqljknmqoolmqirkoomonjkmomosskorqonjqnjikrnpmloqnqqqlqqrqsmiomtimptprjjkllirqkljpkrsojpsnnnlkjrnmlrklimpjrnstrpskmrmjssljlnsrpnkpjlmpnrkmponjit...

output:

186972919

result:

ok 1 number(s): "186972919"

Test #56:

score: 0
Accepted
time: 31ms
memory: 59044kb

input:

pnktrrorlprjqiptqrmomqimrnnprsmprtmlsstllirqnskpsplrjsmntmnsoqjqjtinmljttlsnpomkknipqpmlkmipsrrqjilnjqpsqrmnksmnppljmjtjirtqisnijlmtsntkqrqnotjsoqnqpkjmnsrkkrrppmiottmonikpkkjnnjssprostipnkikkjsoqtmolpkrmlklnojnmjsklqoiojssmssmlpknmilkinttonkknmsjnporllpsokpknpirnskitljjjisptktltrskqtpppotnmposlqqtr...

output:

552643518

result:

ok 1 number(s): "552643518"

Test #57:

score: 0
Accepted
time: 50ms
memory: 66188kb

input:

rkjpqipjjporqmjtkqmmptmplrmomrmpisppiipkmsprpslilrikkppmitkirnsqlnrornqnmtjjtjojossptsrkqnmqjqlkprlrptmkrtltnsortknkptkrmmiislmrlmmrtnjlqopknqmjllkiplqmptlplkmtmmsnplokntlopqlrkinlrnnqoqrnlqlsrolrioqplqltqmpqtqjrkrmiisoomrjtpkintroqoqnjkpqqkriqtqnnsnnkrnsjjmjjsrillktnstponrqoknrppiqsontrimrktrkioisr...

output:

812284221

result:

ok 1 number(s): "812284221"

Test #58:

score: 0
Accepted
time: 57ms
memory: 77544kb

input:

stnsomiskjrlrnkkslkpjllipirpqslrqrjktmskkmilqkkonmoitjsrotsikrlontorkjlrorrknjpjjionmkokqtprijkqjsqnkttsoqtljkjpslisioiqpsmmtrqiqkimmpissnmmtsmjijolisitirkinjmrkknrpmqqjllmiipttopqpjnstqqmrotioikliolnjmjolisqonoooqioitjsmkmiosnqrslrijmqmktjplslijnktjljmimsinktjpssmnsrqlqjjqmqoolpilojjjpksiltnrqtttjn...

output:

1330293994

result:

ok 1 number(s): "1330293994"

Test #59:

score: 0
Accepted
time: 71ms
memory: 85692kb

input:

nlitktppjtjpoiqpqsksslqttqtillpiljjrmrnnttnoqssojtrikkrjpmlljqtilmpmstkmjitlpsilnpsrtqotllptpitqnkrqmnnrjjskmlrlnqjnmqrmjmkkmlsmjptrtqtpnlslkronoptnssqqpimkinkolnriptitppposioooqoploprolsrilmloolpssljisotsjknotmmtnpmprsjlitjipjtljrqilnojpotspqqrkqtirorsqrmtmqmlnoqpisqnormkokmjrkkknmmiptlqjopiqrsnlil...

output:

1723235581

result:

ok 1 number(s): "1723235581"

Test #60:

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

input:

tqkkrlqokpttlolqtolsopllqqjmmkrrrjksklplmiijrisqkjkmqntmrilmtsjktlqimitnnimirnmtomkkolmqtmtpnijqstssoiqirkrkpiqitststrlqtnntqlssrrtokolmskjnplsqiiijlpoojsjopltqsmkrmnqkkrknkjlkkjtponrmmilkotqksqnkktjrjsoqpsoorsomrpprnkojsrsnrooqrlmknooikopqioolsoispjqpjimqookkkrnlqnsktjlrikqrpqnkmqpsritprlnnqilkkssk...

output:

1860579178

result:

ok 1 number(s): "1860579178"

Test #61:

score: 0
Accepted
time: 99ms
memory: 99152kb

input:

psqrqmlrnnqkmslqskmrqpormqiiioprolqljmqnlpoimpmisikliilsrioskrpintqktmlqrojplrprimjlsqnjrmpomqlmsmtptmipmsinrsktskjtjskjiksnspjitikqrnpkllljnqtnkktrppiqmlpkjnpkljqmnlqrkjpqmpmmpikijkrmkptnnstionjtkromjqlmkmprkipjsmospkjssmpmmsoknptoinimskjnrojtqmlnomrkliikkokqntrilkjinoslnpiomtittommrqoiklnjpskklqtn...

output:

2751920446

result:

ok 1 number(s): "2751920446"

Test #62:

score: 0
Accepted
time: 105ms
memory: 106256kb

input:

iroiqrttopkrosssnlimqpiioplsptqqlqsiirtjrjjqpostsrmpsslmnjlrstppkpqskikpipnsjpqrojioollrtrmjlkqqlnlttqrnoslrsnnkmtlokkrlnmqsjqppplppitpnrkttimimmsitmljlsnrsprnjrnloqpjnsknnrmssqljqpsnilnjlsojjlsrtposqjlmkpkjjksqplpioqtjspritstllrkoojmkmniiitrpsmsprjijptlrtspksknkqlrkrppipstmskpikrqskriissskilnjrstps...

output:

3488028595

result:

ok 1 number(s): "3488028595"

Test #63:

score: 0
Accepted
time: 128ms
memory: 107596kb

input:

ooqkslptpknjlpmsjnpqonmirpjkltlijplrnnnmjpqsqoiqpiosqmnkjrontssrpnitsssiktspiosojpnooijqpmsknirionorklqojrknqllotnqpilokrttoqrrpqkslqtijikiqmnprjtrkpponnomrjnslpjoinirpkrjtlqoqllstprotkknopmtrnrijrnjpklilktlsnisnpjokistklnsmnkispnssktrqmilptpnnilnjolqqrojiorqolsrsrjjjsostkkitrljikmojiknjojskskojlost...

output:

3749951500

result:

ok 1 number(s): "3749951500"

Test #64:

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

input:

cspjtokhiqhudcgferqdcydsfepvytvwaatevhozykkkzcesevihelkvuvyqhbaxcaruhntjfuasnsltzmrzravqhcqouzqnaeywnyvfyfikoobykkjencsvzakgjxvgjpxtxtuutkfpyykbxlsewadunppfreamzviahkitjdrbvlriwlekhvutttydecdvoxowjfjsnnntxwqlidfccsynqmlkbqefwmsnlnbgoxivwbxihsjjubmuyadjcyoqyeqferyphniyjwjndtillzbrlfhduiveaobpavreceav...

output:

8404372

result:

ok 1 number(s): "8404372"

Test #65:

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

input:

rwqjauogesdbygmyskfqagwmqcoqqdfeeguythelvazcbobrtfvoansrfhslmepzxrvclquurcjctnyetcunzauejrzsmjkkvcnrjqpusolvxysatpnnwpfhsllhxqecaaobgfxnewrjfumsmblifsijsknmafmsnudqdcpbvrqknrqbgaudraarlgrneosvdmqwijgzsdxwhutzyuemdozamhtwplowoxpferszjajvjtqfjaboveeffckhmgbeimibepmawnknsfkbtgrxajgjyxymuhoyyanchtjohlcw...

output:

26124260

result:

ok 1 number(s): "26124260"

Test #66:

score: 0
Accepted
time: 18ms
memory: 45304kb

input:

xtlngwojmsktiklwyootvxjcdewpoayvhbkiigmwegwcxqxuevphgzxidnlsebmsiuiciiokupxuudqnbbeesxvafjyipesfykrtpklmbtardevscceevfhfaeghcuqrzkrxhhqkgqvpisdfrhjpbfuxjawhqncvipysmaiaqgetniizwurwyutjqlvzpmiszvwnfilewdafekmxoccfaicyaafrloybkzhlaobxxkfpdxayaqconimbhzapqtauagzouvbwqhscgcfwvzjfzysvyirkeodvrsakxckwqoem...

output:

81719497

result:

ok 1 number(s): "81719497"

Test #67:

score: 0
Accepted
time: 26ms
memory: 56788kb

input:

xzoijlxrcneobtzxsrftwpxszsjgwtwmkfvhlbcacqtmibtlikbojlmmlvisscponnlhliqdsqykrqjzhxutjxdtrsrfzggdsowiwigmyqclzkkrplacfpywbokbmtxelaemmfbkhiutdzkzibcerxfxfsugacspckmjloehinglaxihbqlgrmbkpemtxrjcrgrpkhrnpwzafioxvrtcwgnzebaiqbuexomuggplfmanmfkgehvphtbaixrvbbufkcfiihuzpmlhqqtwfyskhddwzixoxbxofwklmycnxuqy...

output:

258645715

result:

ok 1 number(s): "258645715"

Test #68:

score: 0
Accepted
time: 34ms
memory: 65688kb

input:

mripdormghtfqhjrdtolswppdqvevrvcuuudagmcczlzdwslyymdnhoubuqyzmaszlgwdhiqljjbohgmgagjhwysfcekvpoxwbtulybkoihjpkktshfdnzgkyamhnguaymlesmnptcwgmukbppgxjcmefoxhaydarkqvckeubyccbjsmnzrvvexxqjqezhpzjjdgyycndmazeftjxfvbwbxohzuqkbzizaosgajxpnqbsypzuzcbgbucdukdpwormrxpyitltehbgyveckfevfeadzafllieoixithkgknsx...

output:

400906876

result:

ok 1 number(s): "400906876"

Test #69:

score: 0
Accepted
time: 35ms
memory: 67880kb

input:

ilzdqmlwwaezxsypsrpzdxokyneowbrlmuqfhllkrkumzyqozenwrchcjdrqgzpobdgziczyivijuiylqsykufpcomkkbcnrsfwvkcbbygdwupgqmnhywmekcrcriguzzfrewddznaugbqknbcpmkzugncwnmhewpebdjrqudwsyalwfsvabmkpetosbettiivgpoyflurtmttsibwgwwlyxiemgscsjbrpksioicowbgrusymmfdmorkdrcdoltdunhbqspxhskejqafcnjbsgibokgrvcruzgdmsrnhfzk...

output:

449129670

result:

ok 1 number(s): "449129670"

Test #70:

score: 0
Accepted
time: 59ms
memory: 83648kb

input:

dcowxeuzvojnckdbwutdazoitvsmdsehsmgmfytqvuelurdkgxsrpikkgfkzyrehvqjlpsgryoyomxstnzogmoxoznolxogmpcjpqijcypnpedvimqpmvyqckrefrktekgijhbfpatvtckirexrussmgtkaioyyhwrisgzosdoksskojlgboorbzhoqpqtemqthmdidkvmahycrsznfnmqxeyionkevlsgotbjayiifvmfcgfmmgupjbkewoljuwbzngtdeaimoftfurbeymnagdwagtebntksjxfjerucgw...

output:

842920551

result:

ok 1 number(s): "842920551"

Test #71:

score: 0
Accepted
time: 66ms
memory: 84712kb

input:

nfiykjdlphvipvcqkghwncbsbjxpzxvrgpgepbyyomfuynyyfxdjdgtrdhwzcgjuxzjenrxjnxmgdcdzlwxdtwxgxygxebsfvxkolresweohvdhnmaifjjsrynklpcqellblsjxzpreqsmckndnajavcymhsxcrzkjihpwshxpjqsljivvwoljforlteoviuifchhkfvkhykrlgdhhobmvwwxrtowhlzgjzfkhjtpxmxxjxpiyaacgjwynoerhmupipvlhzmamfcllniygitiojvxdorxtyjouaoeeufexrg...

output:

888008404

result:

ok 1 number(s): "888008404"

Test #72:

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

input:

sjjukizbibjtbauflblwyfojalcrofjbpxzudxxtgowfcemimkdsfyzliybwlfbsmwkszspvzrfhflvgfcgxvpepgvievlyfeabtdflpuburjchoicjtktqpvbtmdnihcqvcpwvdsprkddopipytgtufwgtstpwwmhvttzynodeolwrjfnvgodsrkatzvciridvaytgziqsnrovnrurvfjifupirvyeyeqqmslbzlpbamkmylaeytgppdfebbwvjbrtrajghqurgmqeezactpazxakicygrmstosxnpnodja...

output:

1200839973

result:

ok 1 number(s): "1200839973"

Test #73:

score: 0
Accepted
time: 99ms
memory: 103848kb

input:

hagqpwqpggozvvhkaipeufecoblbdgfuuivutvgvpqifliskqdpyysacvkgacqixifhxambcxnbqmqmigubgegkupooomeltpbmkhocrtcmhlobwcffbdsfrrsmoimefbgcbojibzsdajhvjcbmuxozkhtulbkqegewuspayhrsfyjtahratopbevbezmqipateryrhitlsipggkjsvkouufigvhcoylidnoqkfklovdzxxhlzgiapsfzvlctazbwybjzpdwwxbonpqagtdozgodkmscobzmizwcgemrwzcb...

output:

1624365762

result:

ok 1 number(s): "1624365762"

Test #74:

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

input:

dyevsfmqfewmwkdtpvuydljawyxmnapgiyjuoiyohddrrdifhgrzffjzhmpirzwovixdgpuhbfqxwazaieevczvzrlsyrdlsseinhbknqqrqawfbqojfflwvyovowmsnjjrarzgwuxenabpshetfwwcvwvgipyxjkuynzrwhnkvfldtrjsxkylkelsrnjbxhtdzcacfodjugnxuzztyfdedefyhblebfvqzqkqrzkjahrwgdddcggpbcszahujgwwbmgjnfytxugueyltqykftbonwpvesrqutiuixtzidwj...

output:

1730786929

result:

ok 1 number(s): "1730786929"

Test #75:

score: 0
Accepted
time: 79ms
memory: 104248kb

input:

abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaab...

output:

13063858895

result:

ok 1 number(s): "13063858895"