QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#63418#2837. StringologyrunewrzAC ✓108ms63460kbC++172.6kb2022-11-22 00:55:472022-11-22 00:55:48

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-22 00:55:48]
  • 评测
  • 测评结果:AC
  • 用时:108ms
  • 内存:63460kb
  • [2022-11-22 00:55:47]
  • 提交

answer

#include<bits/stdc++.h>
#define fo(i, x, y) for (int i = int(x); i <= int(y); ++i)
#define fd(i, x, y) for (int i = int(x); i >= int(y); --i)
#define fi first
#define se second

using namespace std;
using u64 = unsigned long long;
using puu = pair<u64, u64>;

constexpr u64 base = 29;
constexpr int N = 1e6 + 5;
const u64 mod[2] = {184586209, 184586203};

puu operator-(const puu &a, const puu &b)
{
    return {(a.fi - b.fi + mod[0]) % mod[0], (a.se - b.se + mod[1]) % mod[1]};
};
puu operator*(const puu &a, const puu &b)
{
    return {a.fi * b.fi % mod[0], a.se * b.se % mod[1]};
}
puu operator*(const puu &a, const u64 &x)
{
    return {a.fi * x % mod[0], a.se * x % mod[1]};
}
puu operator+(const puu &a, const u64 &x)
{
    return {(a.fi + x) % mod[0], (a.se + x) % mod[1]};
}
struct hsh
{
    puu p[N], h[N];
    void init(char *s, int n)
    {
        p[0] = {1, 1};
        fo(i, 1, n)
        {
            p[i] = p[i - 1] * base;
            h[i] = h[i - 1] * base + (s[i] - 'a' + 1);
        }
    }
    puu sub(int l, int r)
    {
        return h[r] - h[l - 1] * p[r - l + 1];
    }
}hs, ht;
char s[N], t[N];

void work()
{
    int n = strlen(s + 1), m = strlen(t + 1);
    hs.init(s, n); ht.init(t, m);
    vector<int> nxt(n + 1);
    int j = 0;
    fo(i, 2, n)
    {
        while (j && s[j + 1] != s[i]) j = nxt[j];
        if (s[j + 1] == s[i]) j++;
        nxt[i] = j;
    }
    vector<int> g(n + 1);
    fo(i, 1, n - m)
    {
        g[i] = (hs.sub(i, i + m - 1) == ht.sub(1, m));
        // cout << hs.sub(i, i + m - 1) << '\n';
    }
    j = 0;
    fo(i, 1, m)
    {
        while (j && s[j + 1] != t[i]) j = nxt[j];
        if (s[j + 1] == t[i]) j++;
        if (j == n) j = nxt[j];
    }
    vector<int> ans(n, j), f(n + 1);
    fo(i, 1, n - 1)
    {
        if (g[i + 1])
            f[i] = i;
        else
            f[i] = f[nxt[i]];
        if (f[i])
            ans[i] = f[i] + m;
    }
    fo(i, 0, n - 1)
        cout << ans[i] << " \n"[i + 1 == n];
}

// bool ispri(int x)
// {
//     if (x < 2) return false;
//     if (x == 2) return true;
//     fo(d, 2, x / d)
//         if (!(x % d))
//             return false;
//     return true;
// }

int main()
{
    // for (int i = 184586215, c = 2; c; i--)
    // {
    //     if (ispri(i))
    //     {
    //         cerr << i << '\n';
    //         c--;
    //     }
    // }
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LC
    freopen("t.in","r",stdin);
    freopen("t.out","w",stdout);
    #endif
    while (cin>>(s + 1)>>(t + 1))
        work();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

aaa
a
ababa
a
ab
cd

output:

1 2 2
1 1 3 1 3
0 0

result:

ok 3 lines

Test #2:

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

input:

a
a
a
b

output:

0
0

result:

ok 2 lines

Test #3:

score: 0
Accepted
time: 103ms
memory: 7428kb

input:

aabababbbbabababbbab
bbbbab
bababbbababbbaaabab
babbbaaabab
aababbbaababaaabab
ababbbaabab
bbbaaabbbabbbaab
abbba
babbbababbaaabbaaaba
baaa
ababbaabbb
b
aabaabaaababababa
baa
ababbabaaaabbabaaab
aba
babbbbaabbbbaaa
bbbaabbbb
babbbaababb
bb
aabbbbbabaabb
abbb
abbaaabaabba
abaab
baabbabbbaabb
a
abbbaa...

output:

0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
5 12 12 5 12 5 5 5 12 12 5 12 5 12 12 12 5 12
4 4 4 4 4 10 4 4 4 14 4 4 4 4 4 10
0 0 0 0 0 0 0 0 0 13 0 0 0 0 18 0 0 0 0 0
0 2 0 4 5 0 2 8 9 0
2 2 5 2 2 8 2 2 8 5 2 2 2 2 2 2 2
3 3 3 3 3 8 3 3 3 3 3 3 3 16 3 3 3 3 3
1 1 1...

result:

ok 66657 lines

Test #4:

score: 0
Accepted
time: 91ms
memory: 7496kb

input:

xbdssvishzgn
sh
ujeipazcoaleaylpkunv
lea
vlxevbpfjpbwgtf
pbwg
ujinqdpyzuvstj
in
xrxucchrznpudij
npud
bshzxobrgngbfcxq
sh
vjgxecbpiedzurloi
iedz
qrijljyeohsooojcn
jyeoh
qauzlbdtgr
bdtgr
kmkjvjsrmrxn
jvjsrmrxn
tomaonzruhedjiil
o
bsgxvckwumnjuh
umnjuh
derhbiioqpiqedfwkmy
rhbiioqpiqedfwkmy
dvlzptncsdezg...

output:

0 0 0 0 0 0 0 9 0 0 0 0
0 0 0 0 0 0 0 0 0 0 13 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 13 0 0 0 0 0
0 0 4 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 13 0 0 0 0 0
0 3 0 0 0 0 0 3 0 0 0 0 3 0 0 0
0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0
0 0 0 0 0 10 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 66613 lines

Test #5:

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

input:

ababbbaabaabababbabbbabbaaaababaabbababbbaaabbaabbabababababaabbaaababaaaaabaaaaabaabababbbbaaaabaaaa
aaaaabaa
abbbaababbaaabbaabbbbababbabbbbbbbbbbaaabbabaabbabababaababaaababaaaaababaabbaabbbbaabbabbbbbabbbbbbbaaaaabababaabbabbaaabbaaabaaababbbaabbbabbbbbbbaaaa
abababaababa
abaabaababaaabaabbbbaaa...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 78 1 1 1 1 1 84 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 6693 lines

Test #6:

score: 0
Accepted
time: 62ms
memory: 3552kb

input:

aaaabbbbabbaababbbabaabbabbbbbaaaabbaaaabbabbaabaabbaabbabaaabbabbbbbabbaabbbaabababbbbaabaaabbbbaaabbabbaabbababababababbaabbbbabababbabbabbaaabbabaaabbbbabbbababbaabaabaabbbbbbbbbbaaaaabaabbaabbaabaaaaaaabbabbaabbbbbaaabaaaaaababbababbbaabbbbabbbaabbaabaaabbbaaababaaaaaabbabaaaabbaabaaabbbaaaabaaa...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1461 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok 673 lines

Test #7:

score: 0
Accepted
time: 73ms
memory: 17668kb

input:

abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaab...

output:

24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 24415 ...

result:

ok 7 lines

Test #8:

score: 0
Accepted
time: 82ms
memory: 16448kb

input:

ovoovovoovoovovoovovoovoovovoovoovovoovovoovoovovoovovoovoovovoovoovovoovovoovoovovoovoovovoovovoovoovovoovovoovoovovoovoovovoovovoovoovovoovovoovoovovoovoovovoovovoovoovovoovoovovoovovoovoovovoovovoovoovovoovoovovoovovoovoovovoovoovovoovovoovoovovoovovoovoovovoovoovovoovovoovoovovoovovoovoovovoovoo...

output:

45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 45660 ...

result:

ok 8 lines

Test #9:

score: 0
Accepted
time: 76ms
memory: 15908kb

input:

skkkkskykkkkxkkxkssxksksskkkyksysksskkksysxskvkykykkkkskyskskskkxsyskykssyxkkskkyxkkykkkkskkkykksyskkoskkykkkkksssksskskkkkksyskykykkkkkkkfkkksssokokkykkykyofkkkxkkkykkskkksssxkskykksfsysssskkkkkskskskkskqskskoskkkykosyokssxskskkxkykkkxykskosxxysskkyfkkskksskkkoykkkkyykkxksykxskkssykekksxskskksyykkk...

output:

50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 50817 ...

result:

ok 7 lines

Test #10:

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

input:

xzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxqxzxq...

output:

22653 22657 22653 22657 22653 22661 22653 22657 22653 22665 22653 22657 22653 22669 22653 22657 22653 22673 22653 22657 22653 22677 22653 22657 22653 22681 22653 22657 22653 22685 22653 22657 22653 22689 22653 22657 22653 22693 22653 22657 22653 22697 22653 22657 22653 22701 22653 22657 22653 22705 ...

result:

ok 8 lines

Test #11:

score: 0
Accepted
time: 76ms
memory: 15212kb

input:

abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaab...

output:

54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 54018 ...

result:

ok 8 lines

Test #12:

score: 0
Accepted
time: 85ms
memory: 15240kb

input:

gvggvgvggvggvgvggvgvggvggvgvggvggvgvggvgvggvggvgvggvgvggvggvgvggvggvgvggvgvggvggvgvggvggvgvggvgvggvggvgvggvgvggvggvgvggvggvgvggvgvggvggvgvggvgvggvggvgvggvggvgvggvgvggvggvgvggvggvgvggvgvggvggvgvggvgvggvggvgvggvggvgvggvgvggvggvgvggvggvgvggvgvggvggvgvggvgvggvggvgvggvggvgvggvgvggvggvgvggvgvggvggvgvggvgg...

output:

42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 42539 ...

result:

ok 6 lines

Test #13:

score: 0
Accepted
time: 98ms
memory: 15048kb

input:

iwiwixirhxiiiwwxwxxrwwwwxiwwwiwixwwwrwwxhwiwwgqwxwihrwqwgwwirwiwxwriwiwwwrwiiwxiixwwwqriiiwiqwixwwxiixwxiwhxwwxwirwwwwrwwiriiiwxxqiwwiwiiiwrwwwwxxiwwxwwwwixwiirwwhxxxiwwwwixxwrixhiwiwxwwrwxiiihiwwwwwiwtrwwwwwhwwxihgihwiwwgwirwwiiwwwhwwiwrrwwxiixiwwiwwxiixiwiwiwwhwwxhiwwxrwwxxwixiwwwwwxiwwwqwiwxiiwxw...

output:

36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 36999 ...

result:

ok 7 lines

Test #14:

score: 0
Accepted
time: 92ms
memory: 16804kb

input:

xoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxsxoxs...

output:

37808 37808 37808 37808 37812 37808 37808 37808 37816 37808 37808 37808 37820 37808 37808 37808 37824 37808 37808 37808 37828 37808 37808 37808 37832 37808 37808 37808 37836 37808 37808 37808 37840 37808 37808 37808 37844 37808 37808 37808 37848 37808 37808 37808 37852 37808 37808 37808 37856 37808 ...

result:

ok 8 lines

Test #15:

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

input:

abaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaaba...

output:

63146 63146 63146 63146 63146 63146 63146 63146 63146 63146 63146 63160 63146 63146 63160 63146 63146 63146 63146 63146 63146 63146 63146 63146 63146 63174 63146 63146 63160 63146 63146 63146 63146 63146 63146 63146 63146 63146 63146 63188 63146 63146 63160 63146 63146 63146 63146 63146 63146 63146 ...

result:

ok single line: '63146 63146 63146 63146 63146 ...6 63146 63146 63146 63146 63146'

Test #16:

score: 0
Accepted
time: 92ms
memory: 54000kb

input:

abaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaaba...

output:

15122 15125 15122 15125 15128 15122 15125 15131 15122 15125 15134 15122 15125 15137 15122 15125 15140 15122 15125 15143 15122 15125 15146 15122 15125 15149 15122 15125 15152 15122 15125 15155 15122 15125 15158 15122 15125 15161 15122 15125 15164 15122 15125 15167 15122 15125 15170 15122 15125 15173 ...

result:

ok single line: '15122 15125 15122 15125 15128 ... 15122 15125 999998 15122 15125'

Test #17:

score: 0
Accepted
time: 90ms
memory: 55868kb

input:

xwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxw...

output:

123825 123825 123827 123825 123829 123825 123831 123825 123833 123825 123835 123825 123837 123825 123839 123825 123841 123825 123843 123825 123845 123825 123847 123825 123849 123825 123851 123825 123853 123825 123855 123825 123857 123825 123859 123825 123861 123825 123863 123825 123865 123825 123867...

result:

ok single line: '123825 123825 123827 123825 12...825 999999 123825 999999 123825'

Test #18:

score: 0
Accepted
time: 89ms
memory: 63460kb

input:

abaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaabaabaabaababaaba...

output:

320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320099 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320113 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320085 320127...

result:

ok single line: '320085 320085 320085 320085 32...085 320085 320085 320085 320085'

Test #19:

score: 0
Accepted
time: 108ms
memory: 60344kb

input:

abaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaaba...

output:

278644 278644 278644 278647 278644 278644 278650 278644 278644 278653 278644 278644 278656 278644 278644 278659 278644 278644 278662 278644 278644 278665 278644 278644 278668 278644 278644 278671 278644 278644 278674 278644 278644 278677 278644 278644 278680 278644 278644 278683 278644 278644 278686...

result:

ok single line: '278644 278644 278644 278647 27...644 999997 278644 278644 999997'

Test #20:

score: 0
Accepted
time: 98ms
memory: 63032kb

input:

xwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxwxw...

output:

315180 315180 315182 315180 315184 315180 315186 315180 315188 315180 315190 315180 315192 315180 315194 315180 315196 315180 315198 315180 315200 315180 315202 315180 315204 315180 315206 315180 315208 315180 315210 315180 315212 315180 315214 315180 315216 315180 315218 315180 315220 315180 315222...

result:

ok single line: '315180 315180 315182 315180 31...180 999998 315180 999998 315180'

Test #21:

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

input:

aaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaadaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaadaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaadaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaeaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaab...

output:

36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 36461 ...

result:

ok single line: '36461 36461 36461 36461 36461 ...1 36461 36461 36461 36461 36461'

Test #22:

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

input:

aaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaadaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaadaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaadaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaabaaaeaaabaaabaaabaaacaaabaaabaaabaaacaaabaaabaaab...

output:

75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 75121 ...

result:

ok single line: '75121 75121 75121 75121 75121 ...1 75121 75121 75121 75121 75121'

Test #23:

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

input:

ababacababacababacababadababacababacababacababadababacababacababacababadababacababacababacababadababacababacababacababaeababacababacababacababadababacababacababacababadababacababacababacababadababacababacababacababadababacababacababacababaeababacababacababacababadababacababacababacababadababacababac...

output:

16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 16888 ...

result:

ok single line: '16888 16888 16888 16888 16888 ...8 16888 16888 16888 16888 16888'

Test #24:

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

input:

ababacababacababacababadababacababacababacababadababacababacababacababadababacababacababacababadababacababacababacababaeababacababacababacababadababacababacababacababadababacababacababacababadababacababacababacababadababacababacababacababaeababacababacababacababadababacababacababacababadababacababac...

output:

291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440 291440...

result:

ok single line: '291440 291440 291440 291440 29...440 291440 291440 291440 291440'

Test #25:

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

input:

aaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaadaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaab...

output:

7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 7950 ...

result:

ok single line: '7950 7950 7950 7950 7950 7950 ...0 7950 7950 7950 7950 7950 7950'

Test #26:

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

input:

aaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaadaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaabaaaaabaaaaabaaaaabaaaaacaaaaabaaaaab...

output:

78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 78004 ...

result:

ok single line: '78004 78004 78004 78004 78004 ...4 78004 78004 78004 78004 78004'

Test #27:

score: 0
Accepted
time: 63ms
memory: 51968kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277 265277...

result:

ok single line: '265277 265277 265277 265277 26...277 265277 265277 265277 265277'

Test #28:

score: 0
Accepted
time: 73ms
memory: 58900kb

input:

aaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaadaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaaaaabaaaaaaacaaaaaaabaaaa...

output:

270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149 270149...

result:

ok single line: '270149 270149 270149 270149 27...149 270149 270149 270149 270149'

Test #29:

score: 0
Accepted
time: 84ms
memory: 56980kb

input:

aabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaab...

output:

295931 295931 295931 295934 295931 295931 295937 295931 295931 295940 295931 295931 295943 295931 295931 295946 295931 295931 295949 295931 295931 295952 295931 295931 295955 295931 295931 295958 295931 295931 295961 295931 295931 295964 295931 295931 295967 295931 295931 295970 295931 295931 295973...

result:

ok single line: '295931 295931 295931 295934 29...999 295931 295931 449999 295931'

Test #30:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

263620 263620 263622 263620 263624 263620 263626 263620 263628 263620 263630 263620 263632 263620 263634 263620 263636 263620 263638 263620 263640 263620 263642 263620 263644 263620 263646 263620 263648 263620 263650 263620 263652 263620 263654 263620 263656 263620 263658 263620 263660 263620 263662...

result:

ok single line: '263620 263620 263622 263620 26...998 263620 399998 263620 399998'

Test #31:

score: 0
Accepted
time: 98ms
memory: 61136kb

input:

abacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabadabacabacabad...

output:

297956 297956 297956 297956 297956 297956 297956 297956 297956 297956 297956 297956 297968 297956 297956 297956 297956 297956 297956 297956 297956 297956 297956 297956 297980 297956 297956 297956 297956 297956 297956 297956 297956 297956 297956 297956 297992 297956 297956 297956 297956 297956 297956...

result:

ok single line: '297956 297956 297956 297956 29...956 297956 297956 297956 297956'