QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#44851#464. 前缀函数 / KMPzhoukangyang#AC ✓10ms5952kbC++11673b2022-08-22 09:53:592022-08-22 09:54:00

Judging History

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

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

answer

#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define sz(a) ((int) (a).size())
#define vi vector < int >
#define me(a, x) memset(a, x, sizeof(a))
#define ull unsigned long long
#define ld __float128
using namespace std;
const int N = 2e6 + 7;
int n, f[N];
char s[N];
int main() {
	ios :: sync_with_stdio(false);
	cin.tie(0); cout.tie(0); 
	cin >> (s + 1), n = strlen(s + 1);
	int j = 0;
	L(i, 2, n) {
		while(j && s[j + 1] != s[i]) j = f[j]; 
		if(s[j + 1] == s[i]) ++j;
		f[i] = j;
	}
	L(i, 1, n) cout << f[i] << ' ';
	cout << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 10ms
memory: 5760kb

input:

mencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimen...

output:

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

result:

ok 100000 numbers

Test #2:

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

input:

hyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioihyaknoipnoizjoictsapioioi...

output:

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

result:

ok 100000 numbers

Test #3:

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

input:

dccdcbacdadaccadcbddcccadcbaccdcaacaacaacdddadddaccacbccdcdbcbccbabaacbdccadadaadcadadbcbbccabadcbdbbabaabdbdabdacbcadadccacaadddabadcabdbddadacdcdbddccbadccdbcadddbabcbddbadbdccbcabbbcacddbdbcbdabaaabcbcbcdccaabbbbddbcbdcbcacbbbdbdbdcccbcadadbcdabdaccbdaadadcdacabbdadababadccaddbcbacdddbdaddadcabaa...

output:

0 0 0 1 2 0 0 0 1 0 1 0 0 0 0 1 2 0 1 1 2 3 0 0 1 2 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 0 1 0 1 0 0 1 2 0 1 0 1 0 0 0 0 0 0 0 0 0 1 2 0 1 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 1 2 3 0 0 0 0 1 1 1 0 0 0 1 2 0 0 1 0 1 1 0 1 0 0 1 2 1 0 1 1 ...

result:

ok 100000 numbers

Test #4:

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

input:

daecacbeccccdbbaebaeeddaaccbcbccbcceadeadeeeccbbececdaedabeddcbcbddbebeebdceebddbddddcaddcdcdabbbeccbecdcebeecbeccadbeecabbacdcabdeaeeeacaeeaccaabeabaddbdaabbeebbedaabadbacdcdedcbebbbccbcbdbccbbdecadceebcbaacbbeeeeeebadcccbadcdbdcbcbeddcbababaceeeabebdaacdcdbadedcacbbbbcacbaacdebccddadcbdbebdbeebcde...

output:

0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 2 3 1 2 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 1 1 1 1 0 0 1 1 0 1 0 1 2 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 100000 numbers

Test #5:

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

input:

wikipediaishostedbythewikimediafoundationanonprofitorganizationthatalsohostsarangeofotherprojectswikipediaishostedbythewikimediafoundationanonprofitorganizationthatalsohostsarangeofotherprojectswikipediaishostedbythewikimediafoundationanonprofitorganizationthatalsohostsarangeofotherprojectswikipedia...

output:

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

result:

ok 100000 numbers

Test #6:

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

input:

thetiananmensquaremassacreorthetiananmensquareincidentcommonlyknownasthejunefourthincidentthetiananmensquaremassacreorthetiananmensquareincidentcommonlyknownasthejunefourthincidentthetiananmensquaremassacreorthetiananmensquareincidentcommonlyknownasthejunefourthincidentthetiananmensquaremassacreorth...

output:

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

result:

ok 100000 numbers

Test #7:

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

input:

hcgbgdebehcfabfggdhgdhcbadehegchfgdaafebhcedddhdffhhbhfaeeebcbffahadagacccgdbdacedehheebffedbdgbccddeffhdfbdhdbhhehhedeefdhbhbefbcehhddabdcdhchdhfdafcdeahhedgbffegfbbbbcahebgceffhahbgcbagghbegcadbfbghhhfbdbhagachcbgcfedeccfdabdhccafdgcbaeadcfaagdbcfbdegbebhgbedaddfcdbbgdafeheecdfdcageacdedaagdhdgfbg...

output:

0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 1 0 0 1 2 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 1 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 2 1 0 1 0 0 0 0 0 ...

result:

ok 100000 numbers

Test #8:

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

input:

abhfdbecddegggdgedchebbdhbgfichbecfhbdeagigaiebbeadhcaegeciecfdebachddgeegbbcfebhedgiidcfbfidheghhegebgfhegfcifcdhdiaebdefaeheeieccgdbcdcahhgdibibaeechfbedfaccihafcefiafaciabeihhdbbfiacfdcaefcbdaccfcbfaaaihggighidchiiidciedfddcdfebbchbicbfbaahcfefhifegbgadciggegadfdahceiaebfgbbahiaefibhediheeghbhcfb...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 ...

result:

ok 100000 numbers

Test #9:

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

input:

eehbajgihhcffaabdjhahigjggabhebjfieabdhhchhcbeijdffegicibbfgfgcdcbiehedfcagahaffhgechccbefjeijjbdeeffdfaijaddababgchdicdegjhajeeicijhjebbhaehhjeaafefjbghhaiggfjjaaacbfehjeaeijbghadbgichcbjddafafhdfigjaefggjjcfceggifaahbjhbchbggijijhchjcbgbdabgdbbccaaagcdeeaagiggbecffjhcjcjhhbbciggbdbgbjcjjcbajcidacb...

output:

0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 2 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 ...

result:

ok 100000 numbers

Test #10:

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

input:

fkhhajejijdabgccfhffekjjhdggcfedkbdgadadihckegecjeedaifchbajicajieiadaecfhbbhfjdaeafcjfgdhdeiehedjkhifhfhfeijejjaiifahdakdhhgehigjkhdjhgdbkkbhbahegjbhijhggabdfakkcfgbgaidkeeafgfakahekhdchabbdkjgfkkhkfjjkgkgddijbhbiffkjkaifkeddaabadfjajbekaahdiaijgkkahhdcaajadbcdkjaabgjjeekhfhbagffbiaedddkjkjdfdfdcgj...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 100000 numbers

Test #11:

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

input:

ijhjjigggjjggjhjjijihjjihgjjhihgjjhjjiiiiihjjijjiijjhihgfjjiijjjjgighhfgjjfijjjjijijjijhihjgjigjjhjhjjjhjdhjijejjijjjijhijghjiijjijgijjhjjihijijijhjgjjjjijjiijjgjjjiijgjjijhjjhgjghhjjihjhfijjjjiijjijjjfifijgijhjjjjjjjjjijjhjjfijjjijjehjhjjiijfeiihejijijiijhgjjjjihjjjejjjjfhjjjfihigjjijijgjifijjhjjhj...

output:

0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 1 2 0 1 1 2 0 0 1 0 0 0 0 0 1 1 2 0 0 0 0 1 0 0 0 0 0 0 0 0 1 2 0 0 0 1 2 1 2 0 1 2 3 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 1 2 0 0 1 2 3 1 2 0 0 0 1 1 2 0 1 2 0 1 2 0 0 0 0 1 0 1 2 1 2 1 2 3 4 0 0 ...

result:

ok 100000 numbers

Test #12:

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

input:

jjjfjiijhijhjijhjiijhijjjjjgjifihiijjjjhhijjjigjgjijijjiijfijiijijfhijhijjjjjjjjijijejjjiijeijjhjigjjihjijjihjjjjjjjiihieijjjihihjijhjjjjijijdhjjjihhehcjjijiijjfhggjhfjjjjjjijjjjjigieihjiijijjgfjihjjhhjiijijjjjjjiggghjijjgijfjighjjjgjigijjgjiiiijiijigjgjijjiijjijiijhjjhjjjjhfjjjiiieijfififijihjheihj...

output:

0 1 2 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 0 1 0 0 1 2 3 3 3 0 1 0 0 0 0 0 0 1 2 3 3 0 0 0 1 2 3 0 0 1 0 1 0 1 0 1 2 0 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 2 3 3 3 3 3 3 0 1 0 1 0 1 2 3 0 0 1 0 0 1 2 0 1 0 0 1 2 0 0 1 0 1 2 0 0 1 2 3 3 3 3 3 0 0 0 0 0 0 1 2 3 0 0 0 0 1 0 1 0 1 2 3 3 0 1 0 1 0 0 1 2 3 0 0 0 0 ...

result:

ok 100000 numbers

Test #13:

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

input:

hjfjjjgjiajijhjijhijhgjijijhjjijfjhiiihijhjjjjhijjjjjiijhjjjjihidjijjhiiigdhjijjjjhijijihijjjjijjjiijcigihijihijgijjijijiijjijijgjigjjjjijjiijhjjfijijidijgihjijjjhjfjjjjijijiiigiiijijjhjfhjjgjjfijhijijejjjjijjjjijghejgjifjjjjiijhjjijjjjidjjjjgijgjjhjjjihhhihijjiigjiiijjjijjijiiihjijjjijijjhjhgjjjhhh...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 1 0 0 1 0 0 0 0 0 0 1 2 0 0 0 0 0 1 0 0 0 1 0 0 1 2 0 0 0 1 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 2 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 ...

result:

ok 100000 numbers

Test #14:

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

input:

jgjjihiiihhijjhjijjjifhjijjjgjjijgjijjghjjijeghgjjjjjjijjgjifijgjjjijijgjhjhicijijgjijjihcjjijgjjijjjjjhijjihijjjiijhhfjjijhiijjjejjjggjjjjhhiijijhjjjjhgjhjejejhijgijhijjhjgijijijjhjijjjgifhijjhijijigijjjjghdijghjgjifiijijigidfjjhiijgjjijjiiiifhjijjjcjijhjjjiijjijjejjjjihjjijjjfijjijiiijigjijhfijjji...

output:

0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 1 0 1 1 1 0 0 0 1 0 1 1 1 2 3 4 5 1 2 3 0 1 1 2 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 0 1 1 2 3 0 0 0 1 2 3 4 1 0 1 0 1 2 3 0 1 0 0 0 0 1 0 1 2 3 0 1 1 0 0 0 1 1 0 1 2 3 4 5 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 1 1 0 1 1 1 2 0 1 1 1 1 0 0 0 0 1 0 1 0 1 1 1 ...

result:

ok 100000 numbers

Test #15:

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

input:

hgjgjjjiijjjghjjijhjjjijijhijjgjjiiiijjhjjjhgjjiiihiijjhigbjjihihjjhjghgjffjhiiihjihjjjigjijjhjjijjgjcjjjiijjiijhjjhjjjhjijegiijhjjjjjgeghfijfijgijjiijjjjijhihjjghggjhjjjjijbjjijjiejjhgijighhjfijjhchfjijiijighihgieiijijhijjjjjjjijgjijjjjijjiiehijjjjhhjjjcjijfhjigjghijjjigjhjjjjjhhjjjjjigjgijjgjjgjji...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 2 3 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 2 3 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 100000 numbers

Test #16:

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

input:

ijjijjjjjjjjhjijjjjjiijiijjjjijjjjjijiijihjjjijjijjgijjhjjjhjjigjjijijjijihjjjjfjjhjjjjijjjjjjjjjjijhjjjjjhjjjjjgiijijjjjjjijjjjjjjijjjjjjijhjjjhjjjjjijjjjjjijjjjijjjjjjjjjjjijijijjihjijhjjjjjihjjjjjjjhjijjijjjjjjjjjijijjjijjjijjjjiijjjijjjijjijjjijjgjjhjgjjijjjjijjjjjjhjijjjhjjjijjiiijjjjjijijhjhjh...

output:

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

result:

ok 100000 numbers

Test #17:

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

input:

jjjjjjhjjiigjjjjjihiihjjjjjijhiiiijjjjihjijjjjijjjiijjjijjjjjjjjjjjjgijijjijjjijgjjjjjjjjjgijjjiijijijjjjgjjijijjgjjjjjhijjjjjijjhijijjjjjijjjjjjjjhjjijjjijjjiijijjjjjhjijjjjjjjijjjgjhiihjhhjijhiijjjjjjjjijjhgjjijijjjjijjhijehjjjjjijjjjijjjgijjiijjijijijijjijjjjjhjijjihjjjijjhjjjjjijjijijjiijjjijjij...

output:

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

result:

ok 100000 numbers

Test #18:

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

input:

hjjjjjjjjjijjjjjjjijjjjhjjjhjijijijjejjjjjgiijjjijjjjjijgijihijjjjjijjjjjijjjjjjijighjjhiijihjjjiijjjjiijifhjiijijiiiijjfihjijjjjjijgjjijjijjjijjjjiijjgjjjjjjjjjjhjjhiijjjjejjjihjjijjjjjijjijijijjjjijjijijjjijjijjiijijjjhhjiijijjjjjjjhijiijjjjiiihjjjjjjjijjjjijhhjjjiijhjjjijjijjjjjjjjiijfijjjjjjjjii...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 1 0 0 0 0 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 100000 numbers

Test #19:

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

input:

hhfhhghhhghhhghhhhghhhhfhhhhhhhghhhhhhghgdhhhhehhhhhhhgghfhhgghgghhhhgfhhhhhhhhhghhhhhhhhhhghghhhhhgghhhhghhhhhhghhhhhhhhghhhhhhhghhhhhehhhhhghhhhhhhhhhhhhhhhhefhhghhhghghhhehhhghhghhhghghghhhhghhhhhhghhhhhhghhhghhggfghhghhhghhhhhhhhhghghghhhhhhhhhhhhhhhghhhhhhhghhhhghhhgghhhgghhhhhhhghhhhhhhhhhhhhh...

output:

0 1 0 1 2 0 1 2 2 0 1 2 2 0 1 2 2 2 0 1 2 2 2 3 4 5 2 2 2 2 2 0 1 2 2 2 2 2 0 1 0 0 1 2 2 2 0 1 2 2 2 2 2 2 0 0 1 0 1 2 0 0 1 0 0 1 2 2 2 0 0 1 2 2 2 2 2 2 2 2 0 1 2 2 2 2 2 2 2 2 2 0 1 0 1 2 2 2 2 0 0 1 2 2 2 0 1 2 2 2 2 2 0 1 2 2 2 2 2 2 2 0 1 2 2 2 2 2 2 0 1 2 2 2 2 0 1 2 2 2 2 0 1 2 2 2 2 2 2 2 ...

result:

ok 100000 numbers

Test #20:

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

input:

hhhghhhhhgghhhhhhhghhhhhghhhhgghhhhdhhhhhhghhhhhgfhhggfghhghhhgfhhhhghhhhhhhghhhfhhhhhhhgghfhhhhghhghhhhghhhhghhehhhhhghhhhhghhhgghhghhghhhhhhhhhhhghghgghhhhghhhhhhghhgheghdfhghffghhhgghhghhhhhghfghgghhhhhhhghhhhghghfhhhghhhhhhhhhghhhhhghhhhghfhhhgfhdhhhhhghghghhhhhfghfhhhhhhhghghhhhhhghhhghehhhhhhg...

output:

0 1 2 0 1 2 3 3 3 4 0 1 2 3 3 3 3 3 4 5 6 7 8 9 10 5 6 7 8 4 0 1 2 3 3 0 1 2 3 3 3 3 4 5 6 7 8 9 10 0 1 2 0 0 0 0 1 2 0 1 2 3 4 0 1 2 3 3 4 5 6 7 8 9 3 3 4 5 6 7 0 1 2 3 3 3 3 3 4 0 1 0 1 2 3 3 4 5 6 0 1 2 3 3 4 5 6 7 8 4 5 6 0 1 2 3 3 3 4 5 6 7 8 9 10 5 6 7 4 0 1 2 0 1 2 0 1 2 3 3 3 3 3 3 3 3 3 4 5...

result:

ok 100000 numbers

Test #21:

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

input:

nnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawdrscqmcuqxnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawdrscqmcuqxnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawnnnnnnnnqawdrscqmcuqxnnnnnn...

output:

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

result:

ok 100000 numbers

Test #22:

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

input:

kkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifsbtbaipssflkkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifsbtbaipssflkkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifskkkkkkkkifsbtbaipssflkkkkkk...

output:

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

result:

ok 100000 numbers

Test #23:

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

input:

mmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkbfflhilakcmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkbfflhilakcmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkmmmmmmmmjhkbfflhilakcmmmmmm...

output:

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

result:

ok 100000 numbers

Test #24:

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

input:

uuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumurotunqchvkbuuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumurotunqchvkbuuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumuruuuuuuuumurotunqchvkbuuuuuu...

output:

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

result:

ok 100000 numbers

Test #25:

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

input:

llllllllabtllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtksmwlnlvedllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtksmwlnlvedllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtllllllllabtksmwlnlvedllllll...

output:

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

result:

ok 100000 numbers

Test #26:

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

input:

ffffhokffffhokffffhokffffhokfvhpimffffhokffffhokffffhokffffhokfvhpimffffhokffffhokffffhokffffhokfvhpimffffhokffffhokffffhokffffhokfvhpimffffhokffffhokffffhokffffhokfvhpimffffhokffffhokffffhokffffhokfvhpimffffhokffffhokffffhokffffhokfvhpimffffhokffffhokffffhokffffhokfvhpimnpyipcoayzdakjbmgffffhokffff...

output:

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

result:

ok 100000 numbers

Test #27:

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

input:

ccccccccericcccccccericcccccccericccccccceringjniouccccccccericcccccccericcccccccericccccccceringjniouccccccccericcccccccericcccccccericccccccceringjniouccccccccericcccccccericcccccccericccccccceringjniourrlxvwyblzctrocccccccccericcccccccericcccccccericccccccceringjniouccccccccericcccccccericccccccc...

output:

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

result:

ok 100000 numbers

Test #28:

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

input:

yyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyxcxemdsfeyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyxcxemdsfeyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyyyyyyyyaveyxcxemdsfeyyyyyy...

output:

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

result:

ok 100000 numbers

Test #29:

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

input:

ppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqcyeecvhavmydmuppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqqppppppppjqq...

output:

0 1 2 3 4 5 6 7 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96...

result:

ok 100000 numbers

Test #30:

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

input:

sssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgyyrlongmugzesssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgysssshgyyrlongmugzesssshgysssshgysssshgysssshgysssshgysssshgysssshgyssssh...

output:

0 1 2 3 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

result:

ok 100000 numbers

Test #31:

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

input:

whydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakwhydoyoualwaysakgmclepywpcmoxlmpewhydoyoualwaysakwhydoyoualw...

output:

0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 9...

result:

ok 100000 numbers

Test #32:

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

input:

wearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorwearamaskuseatorgwrxpyrnrtrxuvritwearamaskuseatorwearamaskus...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 9...

result:

ok 100000 numbers

Test #33:

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

input:

abaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaa...

output:

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

result:

ok 100000 numbers

Test #34:

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

input:

shadowsocksvpnshadowsocksshadowsocksvpnshadowsocksvpnshadowsocksshadowsocksvpnshadowsocksshadowsocksvpnshadowsocksvpnshadowsocksshadowsocksvpnshadowsocksvpnshadowsocksshadowsocksvpnshadowsocksshadowsocksvpnshadowsocksvpnshadowsocksshadowsocksvpnshadowsocksshadowsocksvpnshadowsocksvpnshadowsocksshado...

output:

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

result:

ok 100000 numbers

Test #35:

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

input:

gaaedccfegcdcfddffbeacgfeeebdbedbaccgffddafcdecagdbaecedfbacfcbfdccadcdffdedbabcddcddcdfaaggedcdebabgaefcdfbebbadbfddfbdgddccdafffgaefcdfbebeeaegfbaeecgcgfaeagefcbfdccadcaabbgafgeafcgegeaggabaecedfbacbaecedfbacebcafcfegbgaggdfedcccdcfddffbedafcdecagdbaecedfbacebbgabddbfggbcaagdffadacbgecccfdfeedagge...

output:

0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 ...

result:

ok 100000 numbers

Test #36:

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

input:

fdcdbfgffcfeggecbdbbbadgcbcdffdafcefeaaecegeccdabecfgaafggaagcbadedfbecegeccdabeccbabafcdeeacbccefcfcfgaafggaaebdcbdfdcbbedbeafeegfccadebacbfccadebacbgfbdcaaadgfbbfdfedbbbbgecddbdafgdggfggfbbedebfbfagfeggecbdbbbadgcbcdffdgbaadcgedfdcdbfgffccfgfcafcabeabffbfbdbfccadebacbfccadebacbfbbfdfedbbdgebdfgcce...

output:

0 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 2 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 ...

result:

ok 100000 numbers

Test #37:

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

input:

addbabdbgabcbccebcfccbbafafeebcbbafafeebeadacgggbbbdcbfgdddcdfgeadebaeddcaaafbbcgbfegdgabdbcdabdcedgaebfagfgfebdgafgbbgbbacaccdgcdcfddccafafdcffbbffageebgfaccgddcffbbffaggebaageagddfgeadebaeeebggdgddgcccbceaeagbbfedccaeggdbdaaebccbddcgdbaabebefbaaffdgbfegdgabdgbadgdbdaffecdacdaeadfgeadebaebbfedccaeg...

output:

0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 ...

result:

ok 100000 numbers

Extra Test:

score: 0
Extra Test Passed