QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#421842#6459. K-Inversionsnitrousoxide#AC ✓935ms102180kbC++142.1kb2024-05-26 08:03:522024-05-26 08:03:52

Judging History

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

  • [2024-05-26 08:03:52]
  • 评测
  • 测评结果:AC
  • 用时:935ms
  • 内存:102180kb
  • [2024-05-26 08:03:52]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

using cd = complex<double>;
const double pi = acos(-1);

int reverse(int num, int lg_n) {
    int res = 0;
    for (int i = 0; i < lg_n; i++) {
        if (num & (1 << i)) {
            res |= 1 << (lg_n - 1 - i);
        }
    }
    return res;
}

void fft(vector<cd> & a, bool invert){ 
    int n = a.size();
    int lg_n = 0;
    while ((1 << lg_n) < n) {
        lg_n++;
    }
    for (int i = 0; i < n; i++) {
        if (i < reverse(i, lg_n)) {
            swap(a[i], a[reverse(i, lg_n)]);
        }
    }
    for (int len = 2; len <= n; len <<= 1) {
        double ang = 2 * pi / len * (invert ? -1 : 1);
        cd wlen(cos(ang), sin(ang));
        for (int i = 0; i < n; i += len) {
            cd w(1);
            for (int j = 0; j < len/2; j++) {
                cd u = a[i+j];
                cd v = a[i+j+len/2] * w;
                a[i+j] = u+v;
                a[i+j+len/2] = u-v;
                w *= wlen;
            }
        }
    }
    if (invert) {
        for (cd & x : a) {
            x /= n;
        }
    }
}

vector<ll> multiply(vector<ll> const & a, vector<ll> const & b) {
    vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
    int n = 1;
    while (n < a.size() + b.size()) n <<= 1;
    fa.resize(n);
    fb.resize(n);

    fft(fa, false);
    fft(fb, false);
    for (int i = 0; i < n; i++) {
        fa[i] *= fb[i];
    }
    fft(fa, true);

    vector<ll> result(n);
    for (int i = 0; i < n; i++) {
        result[i] = round(fa[i].real());
    }
    return result;
}

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<ll> s1(n), s2(n);
    for (int i = 0; i < s.size(); i++) {
        s1[i] = (s[i] == 'B') ? 1 : 0;
    }
    for (int i = 0; i < s.size(); i++) {
        s2[i] = (s[i] == 'A') ? 1 : 0;
    }
    reverse(s2.begin(), s2.end());
    vector<ll> ret = multiply(s1, s2);
    for (int i = n -2; i >= 0; i--) {
        cout << ret[i] << endl;
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3860kb

input:

BABA

output:

2
0
1

result:

ok 3 lines

Test #2:

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

input:

BBBBBAAAAA

output:

1
2
3
4
5
4
3
2
1

result:

ok 9 lines

Test #3:

score: 0
Accepted
time: 437ms
memory: 51712kb

input:

BBBBBAABBBBBBABABBABBBBBBBBABBBBBABBBABBBBBABBBBBBBBBBBBAABBBBBBBBBABBBBBBABBBABBABABBBBAABABABBABBABBBBBBBBBBBBBBBBBBBBBBAABABABABBBAABBBABBABBBBBBBABBABABBABBABABABBBBBBABBBBABBBABBBBBBABBBBBBBABABABBBBBBAABABBAAABABBABAAABBBBABBBBBBBABABABBBBBBBBABABBBABABBABBBBABBBBBBBBBBBBBBBBBBBBBABBABBABBABAB...

output:

76478
76661
76689
76695
76398
76588
76741
76653
76716
76388
76611
76607
76545
76692
76765
76542
76891
76523
76524
76577
76681
76612
76493
76605
76701
76534
76541
76646
76505
76589
76549
76502
76750
76629
76331
76491
76499
76555
76685
76440
76919
76716
76513
76633
76616
76545
76548
76495
76622
76514
...

result:

ok 440584 lines

Test #4:

score: 0
Accepted
time: 809ms
memory: 94956kb

input:

BBABBABAAAABAAABAABABAAABBBAAABBABAAAABAABBABBBBAAABAABAAAAAAAAABBABBABAAABABBAAAABBBBBAABBBBAAABBBAABBAAABABBBABABBBBBBBAABAAABABABABAABBAAABBAABBBAABBBABABABBBAAAABBBAABBBBBAAABABAAAAAAAABBBABBABABBBAAAAABAABAABABBBAABABAAABAAAABAABBBBABAABBABAAABAAAABBAABAABBABABBABBBABBAAABBBBBBABABABABBBBBBBABB...

output:

146088
146190
145557
146161
146002
146016
146193
145981
146162
145980
146264
146202
145687
145569
145745
146476
145854
146011
145925
146027
146049
146012
146120
146134
146304
146251
145662
146158
146173
146089
146181
146212
146285
146202
145698
145981
146125
146057
145916
145770
145923
145952
146016...

result:

ok 584039 lines

Test #5:

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

input:

AAAABABAAAAAABAABBBAABAABAAAAAAAAAABAAABABAABAAABAAAAAAAAAAAAAAAAAABAAABAAAAABAAAABBAAAAAAAAAABBBBAAAAAAABBBABAAAAABAAABBBAABABAAAAAAAAABAAAAAAABAAABAAAAAAAAAAAAABBBAAAAABAABAABAAAAAAAAAABABAAAABAAAAAAAAABAABBAAAABAAABABAABABBBAAABBAAABAAABAAAAAABAAABAABAAAAABBAABAAAAABABAAABAAAAAAAAAAAAAAAAAABAAABA...

output:

17778
17759
17881
17740
17674
17742
17660
17846
17869
17849
17834
17760
17825
17743
17794
17799
17794
17791
17846
17911
17710
17850
17773
17782
17858
17774
17852
17770
17776
17786
17692
17758
17807
17665
17792
17788
17728
17652
17705
17773
17749
17848
17749
17793
17827
17686
17837
17808
17768
17793
...

result:

ok 103351 lines

Test #6:

score: 0
Accepted
time: 829ms
memory: 96928kb

input:

BAABABAAAAAAAAAAABABAABAAAAAAAAAAAAAAAAAAAAAAABAAAAAABAABAABAAAAAAAAAAABAAAAABBAAAAAAAAAAAAAAABAAAABABAAABAAABAAAAAAAAAAAAAAAAABAAAABABBBBAAAABAAAAAAAAAAAABAAAAAAAAAAAABAAABAAAABBBAAAABAAAAAAABAAAAAAAAABAAABBBBAAAAAAAAAAAABAAAAABAABAAAAAAAAAAAAABABABAAABBABBBBAABAAAAAAAAAAAAABAAAAAAAAABAABBAAAAAAABB...

output:

123851
123871
123738
124172
123515
123877
123880
124003
123891
123839
123787
123619
124144
123752
123817
124079
124072
124021
123723
123874
123885
123562
123838
123860
123526
123662
123887
123846
123866
123685
123963
123950
123906
123728
124004
124116
124037
123651
123758
123955
123734
124057
123721...

result:

ok 698989 lines

Test #7:

score: 0
Accepted
time: 182ms
memory: 26620kb

input:

BBBBAABBAAABBBBBABBBBBBBBBAABBBABBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBABABABABBABBBBBBABBBBBBBABABABBAABBABABBBBBBBBBABBAAAABBABABBBBBBBABBBBBBBABBBBBBBBABBBBAAABBBBBBBABBBBBBBBBAABBABAABBABBBBBBAABBAABBBBBBBBBBBBABABBBABBBABBBBABBBBBBBBABBABABABBBABBABABBBBBBBBBBBBBBBBABBABBABBBAABBBBBABBBAAABBBBBABBBBB...

output:

30208
30214
30321
30191
30224
30274
30200
30258
30265
30101
30179
30149
30293
30290
30295
30345
30068
30185
30203
30202
30111
30243
30212
30237
30363
30201
30226
30237
30157
30241
30205
30231
30362
30183
30469
30117
30247
30173
30224
30110
30167
30201
30342
30306
30230
30253
30150
30264
30216
30186
...

result:

ok 167398 lines

Test #8:

score: 0
Accepted
time: 807ms
memory: 96460kb

input:

AABABAABABBABBAAABABBBBBAAABBABABABABAABBAABBABAABBBBBBABBBABABABAAAABABAAABAAAAAABBABABAABAABABBABBBAABABABBBABABBBBABBBABABABAABBBBAAABBABBBABABABBBABABBBAABAABBABBBBABBBABBAABAABBABBBAABABBABBABBBABBBBABBBAAABAAABBAAAABBBAAABBBBBBBBBBBAABBABBABBBBBBBAABBABBAABBBBBBAAABBBBBABBBBAABBABAAABAAABBBBBB...

output:

164127
164228
164427
164285
164721
164270
164194
164453
164423
164325
163977
163634
164206
164255
164034
164140
164019
164136
164435
164445
164025
163853
164343
164158
164621
164258
164422
164455
164251
164131
164391
164280
164100
164123
164015
164116
164390
164556
164358
163840
164534
164086
164223...

result:

ok 673325 lines

Test #9:

score: 0
Accepted
time: 870ms
memory: 101156kb

input:

AAABABAAABAAABABBAAAAAABBBABABAABABBBBBBABBABABBBBBBBBBABAAABBABBBABABBAABBABABBAAABABBBBBBABABABBBBABAAABBBAAABABBABBBAABABABABBBBABBBBBBBABAAABABABBABAABABABABAABABBAABBBBABBBABBABBBBBABABBBBAABABBABBBBBBAAABABBAABBABABABAAAABBBBAAAAABBABABBBBAABABBBBAAAAABBAABBBBAABABBBAAABABAAAABBBBABBAAAAAABBAB...

output:

232776
233165
232542
233106
233212
232901
232848
232858
233087
233008
232587
233030
233276
232574
233184
232695
232757
232800
232788
233075
232806
233127
232857
233197
233069
233005
232840
232876
232765
233015
232814
233265
232820
233068
233523
232440
232683
232395
232697
232776
232951
233025
232918...

result:

ok 951828 lines

Test #10:

score: 0
Accepted
time: 817ms
memory: 94992kb

input:

AAAAAAAAABABAAAAAAAAAAABAABAAABBBAAAAAABAAAAABAAAAAAAABAAAAABAAABAAAAAAAAAAABAAAABAAAAABAAABAAABAABAABAAAABAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAABAAAABAABAAAABAAAAAAAAAAAAAABAAAAAABBABBABABAAAABAAAABAAAAAAABABABBAAAABABABABBAAABABAAABAAAAAAAAAAAAAAAAAAAAAAAAABAABAAAAAAAAAABAAAAAABAAAAAAAAAB...

output:

97272
97308
97410
97408
97257
97549
97455
97375
97216
97410
97409
97444
97347
97499
97292
97315
97412
97256
97240
97577
97354
97374
97579
97173
97368
97415
97487
97357
97304
97512
97658
97322
97426
97449
97482
97370
97471
97249
97385
97318
97526
97537
97370
97332
97406
97501
97367
97210
97196
97286
...

result:

ok 586806 lines

Test #11:

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

input:

AAAAAABAAAAAABAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAA...

output:

2736
2741
2742
2742
2734
2728
2725
2729
2725
2729
2742
2733
2740
2741
2728
2734
2729
2737
2731
2729
2723
2722
2701
2736
2727
2726
2733
2737
2744
2725
2721
2725
2736
2734
2729
2733
2739
2732
2740
2721
2739
2726
2746
2725
2733
2743
2739
2736
2729
2739
2746
2740
2737
2729
2724
2752
2730
2737
2732
2733
...

result:

ok 101575 lines

Test #12:

score: 0
Accepted
time: 400ms
memory: 49596kb

input:

BABABAABBBBBBBBBBBBBBBBBBBBBABABBBBBABBBBABABBBBABBBBBBBBABBABBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBABBBABBBBBBABBBBAABBBBABABABBBBBBBBBBBBBABABBBBABBBBBABBBBBBBBABBBBBBBBBBBBBBBBABABBBABBBBBABBBBBABBBBABABBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBABBBBBABBBBBBBBBBBBBABBBBBBBBBBBAABBBBBBBBBBBABBBBBBBBBBBBBAABB...

output:

39069
39044
38987
39193
39054
39185
39016
39007
39067
39013
39115
39056
39257
39044
39057
39097
38988
39071
39057
39059
39025
38974
39100
39160
39087
38948
39203
39181
39067
39096
39080
38992
39058
39020
39020
39090
39093
39186
39068
39110
39071
39153
39098
38947
39091
39051
39060
39013
39032
38957
...

result:

ok 317042 lines

Test #13:

score: 0
Accepted
time: 414ms
memory: 49748kb

input:

BBAAABBBBABBBBBBBBBBBBAABBBBABABBBBAABBABBBABABAAABABBAAABBABBABBBAABBAABBBBABBBBBAAABBBAABBBABAABABBABBBAABAABBABABBABBABABABBAAABABBBABBABBBBBBBBBBBABBABAABBBAABAABBBBBBABABABBAABABABBBBAAABAABAABBABABAAABABBBBABABBABBABBBABAAAAABBBABABABBBABABABBABABBBBAAABAABBBABAABBABABBABBABBBABBBABBABBBAABBBA...

output:

73681
73948
74033
73909
73849
73766
73784
74018
74186
73807
73976
73983
74078
74105
74199
73964
73939
73993
73943
73992
74060
73960
73989
74008
74009
73791
74193
73963
74049
73865
74080
73981
74021
73923
73844
73732
73885
74100
74080
73809
74015
73988
73705
73847
74143
73763
74168
74084
73976
73816
...

result:

ok 322711 lines

Test #14:

score: 0
Accepted
time: 182ms
memory: 26952kb

input:

ABBBAABAABABBABBBAAAABBABBBAABBABBABBBBAAABAABBABBAABABAABBAAAAABBABBAABBBAABABBBBAAAABABABAABAAAABABBAABBBABBBBABABBABABBABBABBABAAABAAAABABBAAAAABABBBBBABBBABABABBBBBAAABBABBABBBBAABAAAAABBBBABBBBBBBAABBBBABABBAAAAAAABAAABAAABBBBBBABABBBAAABAABBBAAABBBABBBAAABBBBAABBBBBBAAAABBABBABBBBBABAABAABBBBA...

output:

45603
45695
45537
45514
45625
45651
45512
45417
45393
45643
45591
45800
45573
45559
45423
45610
45511
45684
45619
45545
45645
45224
45496
45425
45635
45407
45535
45531
45660
45849
45574
45504
45606
45365
45745
45710
45551
45328
45579
45435
45539
45565
45641
45436
45592
45718
45509
45703
45409
45514
...

result:

ok 183180 lines

Test #15:

score: 0
Accepted
time: 875ms
memory: 100044kb

input:

AAABBAAAAAAAABBAAAABAABBAABABAABABBAABAAAAAAAAAAABABAAAABAAABABBAAABAAAAAAAAAAAAAAAAABABAAABAAAABBABAAAAAAABAABAABAAAAAABABABBAAABAAAAAABBAAAAAAAABAABABBAABAABAAAAAAAABBAABBABBBBBBBAABAAAAAAAABABAABABAAAAAAAABBABBAAAAAAAABABABBAAABBAABAAAAAAAAABBABABAABABAAAABAAAAAABAAAAABABBABAAAAABBAAAAAAAAABAAABA...

output:

191604
192101
191996
191925
191789
191855
191849
191841
191994
191700
191871
192002
191615
191844
191769
192055
192192
191483
191950
191542
192028
191924
191503
191965
191822
191453
191928
191780
191816
191537
191720
191597
192391
192114
191680
191601
191905
191618
191810
191743
191808
191824
191884...

result:

ok 886949 lines

Test #16:

score: 0
Accepted
time: 24ms
memory: 6632kb

input:

AAAABAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAA...

output:

1174
1177
1169
1167
1170
1185
1169
1167
1169
1176
1168
1188
1161
1163
1175
1158
1166
1169
1180
1167
1186
1169
1171
1173
1175
1178
1166
1169
1170
1179
1161
1172
1165
1177
1177
1174
1168
1167
1169
1179
1180
1166
1171
1174
1164
1172
1153
1168
1175
1161
1181
1167
1161
1169
1165
1177
1172
1167
1160
1174
...

result:

ok 31629 lines

Test #17:

score: 0
Accepted
time: 187ms
memory: 27748kb

input:

BABBAAAAAAAAAAAAAABAAAABABABAAAABBAABABAABAAABAABAAAABBAAAABABAAABAAAABBAABBAABAAAAAAABBABBBAAAAAAAAAABABBAABAAABABBBBABBBABBBABABAAABBAAAABBAABBAABBAABBABBABBAAAAABBAAAAAAAABABAAABAABBBAAABBAAAABBBABBBBABBAAABBBABABAAABBBABAABAABAAAABBBAABBBBAAAAAAABABABBAABAAAAAABBABABBABABBBBAAABAAAABBABBABABBAAB...

output:

55518
55530
55836
55771
55701
55808
55669
55664
55842
55623
55833
55606
55743
55591
55547
55648
55754
55658
55651
55438
55520
55677
55759
55725
55781
55673
55753
55732
55648
55579
55525
55547
55622
55654
55524
55697
55688
55774
55543
55577
55589
55466
55735
55673
55478
55606
55818
55566
55616
55639
...

result:

ok 231455 lines

Test #18:

score: 0
Accepted
time: 826ms
memory: 97248kb

input:

BABABABBBBBABABABBBBBBBBBBBBBAABAABBBBBABBABBBBAABBBBBBBABBBAABBBBABBBABAABBBBAABABBABABBBBABBBBBABABAABBABBBBABBBBBAABAABBBABBABABBBBABABBABBABAABBBBBBBABAABBBBBBBBBBBBBBBBBABBABBBBBBABBBBBBBBBABABAAABBBAAABBABABABBBBABBAAABABBBBBAABBBBBABBBBAABAABABBBAAAABABAABBABBBBABABBABBBAABBBBBABABBBBABBBBBAA...

output:

149673
149727
149812
149812
149983
149453
149769
149585
150054
149593
149720
149825
149805
149898
150050
149992
149695
149813
149607
149694
149811
149468
149610
149926
149771
149662
149482
149516
149785
149620
149698
149477
149528
149609
149878
150008
149712
149610
149899
149861
149630
149841
149740...

result:

ok 707712 lines

Test #19:

score: 0
Accepted
time: 808ms
memory: 97040kb

input:

ABBBBBBAAABAAAAABAAABABBAABBBABBBBABBBBAAAABABAAAAAABAAABBBABAAABABABBBAABAAABABABBBBAAABABAABBBAABBABBAABBBAABAAABBAAAABAABBABAABAABABBBBBABAAABABBBBABABABBBBAAABAAABBAAABBABAAABBBAABABBBAAABBAAAAAABAAAAAABBBABABBBABAABBBABAABABAABBABAAAAAABABBBBBABAAABBAAAAABBBAAAABBABBAAAABBABBBBBBABBABBAAAAABBAA...

output:

172582
172738
172909
172379
172527
172418
172628
172955
172870
173167
172749
172475
172831
172416
172644
172989
172710
172514
172646
172597
172329
172322
172594
172698
172958
172602
173010
172545
172672
172728
172556
172855
172685
172299
172941
172993
172716
173071
172869
172840
172854
172822
172749...

result:

ok 691892 lines

Test #20:

score: 0
Accepted
time: 413ms
memory: 50268kb

input:

ABBAAAABAAAAABBAAAABAAAAAAAABAAAABAABBBABAABABBBABBBBAABBABABAAABAABBBBABBABBBBBAABABBAAAAAABAABBABAABBAABBBBABAABAAAAAABAAABBBAAABAABBABBABBABBAABAABABAAABABBBAAABBBABABAAAABAAABBBAAABBBBABABABBBBAAAAABAABAAAAAAAABAAAABAAAAABBBABBABABBBBABABAABBBAAABBAAAABBBBABABAAABBAABAABBBBBABBAABAAABBBBAAAABABB...

output:

85994
86249
86548
86494
86324
86401
86205
86486
86656
86232
86558
86527
86244
86290
86400
86311
86332
86369
86269
86546
86512
86046
86289
86453
86628
86482
86517
86288
86352
86381
86585
86105
86575
86256
86522
86266
86370
86068
86414
86315
86611
86425
86192
86458
86583
86307
86617
86511
86514
86462
...

result:

ok 345663 lines

Test #21:

score: 0
Accepted
time: 833ms
memory: 95548kb

input:

BBBBABBAAAAAAAAABAAAABABBABBABAABABAAAAAABAABAAAAAAAABAAAAABBAABAAAAABBAAAAAAAAAAABAABAABABABAAAAAAAAAAAABABABAABABAAAAAAAAABAAAABAAABBAABAAABAAAAAAAAABAAAAAAABBAAAAAAAABAABAABAABAAAAAAAAAAAAABABBAABAAAAAAAAAAAAAAABAAABAAABAAAAABAAAAAAAAAAABAAAABAABAAAAAAAABAAABAAAAABAABAAABAAAAAABAAABAAAAAAAAAAAAAA...

output:

108436
108636
108279
108462
108580
108461
108515
108357
108294
108383
108558
108320
108404
108557
108431
108400
108338
108557
108609
108411
108444
108473
108470
108515
108458
108644
108647
108419
108583
108712
108523
108650
108491
108599
108345
108361
108534
108517
108442
108649
108333
108486
108507...

result:

ok 604956 lines

Test #22:

score: 0
Accepted
time: 895ms
memory: 101184kb

input:

BABBBBAABBABBBAABABBAAAABBBBBBAAABBBBABABAABBBABABBBABABABAAAAAABBBBABBAABABAAABABBBBABABAABBAAABBBBBBABBBBABAABBABABABBBBAABABBBABBAAABABAAAABABABBABAABBBBBBBBBABAABBABABBBABBAAAAAAABBABAAAABABBBBBBBABABBAAAABBABBAAAABBABAABAAABBBABABBBBBBABBABBABAAABBBBBBBBBBBABAAAAABBBAAABABBBABAABAAABABAAABBAAAB...

output:

236412
236306
236431
236607
236597
236384
236145
236791
236817
236463
236749
236079
236673
236175
236255
236574
236616
236787
236666
236125
236558
236703
235949
236969
236564
236576
237082
236882
236475
236402
236352
236663
236533
236702
236840
236505
236468
236718
236636
236408
236757
236713
236860...

result:

ok 952889 lines

Test #23:

score: 0
Accepted
time: 795ms
memory: 95112kb

input:

BBAABBBAAABAAABABBBABABBAABABABAAAAAABBBBABBBAABBAABBAAABABAABBBABBBBABABAAABBABAABBBBBBABBABBAABAABABBBAAABBBAABAAAABBBBBABBAAAAABBBAABAABABBBBBBBBBABBBBBAAABAABBABAAAAAABBBBABABABBBABAAAABAABAAABBBBAABBBABBABAABBBAAAAAAAAAAAAABBABBABAABBAABBBBBBBBBABABABBBAAABBABBBABBABBABBABABBBAABAAAABBAAAAABBBB...

output:

143349
143284
143633
143534
143621
143536
143843
143648
143714
143352
143379
143546
143735
143444
143547
143641
143252
143243
143384
144072
143725
143705
143369
143627
143748
143628
143440
143619
143749
143679
143380
143448
143549
143591
143510
143519
143007
143489
143793
143788
143572
143387
143726...

result:

ok 580785 lines

Test #24:

score: 0
Accepted
time: 899ms
memory: 101672kb

input:

BBABBABBBBBBBBBBBBBBAAABBBBBBBBBBAABBBBBBBBBBBBABBABABBBBBBBBABBBBABABBBBAABABBBBBBABBBBBABBBBBBBAABBABBBBBBBBBBBBBBBBBBBAABBBBBBBBBBBABBBBBBBBABABBAABBBBBABBBBBABBBABABABABBBBABABABABBBBBBBABBBBBBABBBBABBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBABBBABBAAABBBAAAABBBBBBBBBBABBBBBBBBBBBBBBBBBABBAABAABBBB...

output:

161186
161206
160790
161109
161077
161057
160979
161231
161202
161177
161197
160930
161083
160567
160655
160806
160912
160808
160766
160678
160750
160965
160757
160647
160962
161024
161037
160787
160860
161044
160971
160833
161009
161007
160806
160816
160612
161000
160707
160872
160932
161016
160945...

result:

ok 976421 lines

Test #25:

score: 0
Accepted
time: 51ms
memory: 9300kb

input:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAA...

output:

867
865
859
863
859
867
862
866
867
862
869
865
860
856
854
861
861
867
859
864
860
862
863
864
865
866
867
867
865
862
864
855
859
859
863
858
866
866
859
860
861
857
862
871
853
861
864
862
858
863
859
871
865
859
860
863
858
861
866
862
859
856
866
865
862
861
855
855
856
862
860
861
866
865
866
...

result:

ok 49485 lines

Test #26:

score: 0
Accepted
time: 183ms
memory: 27684kb

input:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

output:

4800
4799
4789
4776
4794
4785
4794
4788
4774
4787
4753
4801
4784
4791
4797
4786
4801
4792
4796
4792
4792
4782
4785
4794
4785
4801
4794
4799
4773
4794
4779
4782
4783
4789
4808
4796
4794
4797
4788
4797
4773
4785
4795
4789
4794
4777
4776
4771
4805
4796
4783
4788
4769
4804
4789
4782
4788
4788
4787
4786
...

result:

ok 231040 lines

Test #27:

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

input:

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

136
135
137
137
136
137
138
136
135
136
136
139
137
135
136
138
137
138
136
138
135
139
137
139
139
135
137
135
136
138
138
137
138
138
139
138
138
134
137
137
138
137
138
137
137
136
135
135
137
138
137
134
137
137
136
137
138
138
137
137
137
136
136
134
135
137
137
138
137
136
135
136
136
136
136
...

result:

ok 10127 lines

Test #28:

score: 0
Accepted
time: 412ms
memory: 50936kb

input:

AAAABABABAABAABAABAAABABBABAAAAAAAAAAAAAAABBAAAAAABAAAABAABBBBAAAAABAAAAABABAABBABAAABABABABAAAABABAABAAAAAAAABAAAAAAAABBAAAAABBAABABBAAABABAAAAABBAAAAABABBAAABAABAAAAAABAAAABAABAABAAABAABABABAAABBBAABBABAABAAAAAABAAAAABABAABAABABBBBAABABAABABAAAAAAABBAAAABBAAAAAABAAABAABAABAAAAABBAAABAABAAAAABAAAAB...

output:

77410
77413
77255
77290
77384
77455
77209
77100
77137
77437
77189
77461
77367
77349
77440
77537
77244
77171
77170
77437
77231
77230
77348
77272
77329
77178
77370
77347
77302
77289
77340
77150
77120
77167
77503
77364
77231
77260
77242
77200
77144
77267
77168
77192
77402
77184
77216
77118
77342
77319
...

result:

ok 395103 lines

Test #29:

score: 0
Accepted
time: 831ms
memory: 96192kb

input:

AAAABBABBBAAAABBBAABAAABBABAABAABABABBBAABBABABAABABBAABBABBAAAABAAABAAAAABAAABABBBBBBAAAAABAABAAABBAABAAAABAAABBBBBBAAAAAAAAAAAAAAAAABABABBAAAAABABBBAAAAABBAAAAAAABBBAABBABAAABBBABBBAAAABAAAAABABAAABABAABAAAABAAAAABABAAABBABABBBAAABBAABAABAABBAAAAABBBBAAABAAAAAABBABAAAAAAAAAAABAABABBAAAAAAABBAAAAAA...

output:

151617
151967
151946
151636
151987
151946
151834
151679
151978
151785
151842
151615
151832
151636
151350
151957
151887
151874
151564
151647
151617
151817
151634
151975
151988
151839
152000
151661
151725
151628
151840
151667
151528
151592
151759
151465
151848
151905
151700
152048
151915
152065
151572...

result:

ok 655201 lines

Test #30:

score: 0
Accepted
time: 860ms
memory: 98748kb

input:

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBB...

output:

30356
30302
30261
30314
30278
30243
30323
30322
30288
30288
30281
30254
30227
30223
30240
30269
30291
30266
30220
30234
30256
30302
30312
30266
30281
30267
30281
30308
30264
30288
30278
30282
30281
30294
30345
30257
30295
30287
30278
30262
30339
30298
30254
30309
30283
30253
30303
30275
30273
30290
...

result:

ok 804664 lines

Test #31:

score: 0
Accepted
time: 400ms
memory: 48916kb

input:

AAAAABAAAAAABAAAABAAABABAAAAAABAAAAAAAAABAABBABBBBABABBABABAAABBBBABAABBAAABBAABAAAABAABBAAABAAAAAAAAAAABBBAAABAAAABABAABAABABAAAAAAAAABBABAAABABAABAAAABAAAAAABAAAAABAAABABAAAAAAABAABBBABAABAABAAAAAAAAAAAAAAAAAAABAABAAAABBAAAAAABABBBAABAABAAAAABBAAAAABAABBBAAAAABAAAAAAAAAAABABABAABBBBAAAAAAAAAAABABB...

output:

52884
52755
52833
52927
52764
52753
52803
52652
52742
52582
52733
52647
52600
52749
52745
52765
52856
52706
52630
52812
52940
52757
52775
52754
52651
52730
52798
52778
52748
52747
52898
52632
52655
52577
52827
52754
52835
52667
52760
52587
52797
52899
52831
52709
52761
52886
52799
52756
52691
52723
...

result:

ok 266726 lines

Test #32:

score: 0
Accepted
time: 792ms
memory: 95896kb

input:

BAABBBBBBBBBABABBBBBBBABBBBBBABBBBABBBBBBBBBBBBABBBABBBBBAABBBABBBBBABBBBBBBAABBBABBBBBBBBBBBBABBBBBBBBBAABABBABBBABBBBBBABBBBBBBBABBBBBABBBBBBBBBABABBBBBBBABBBBBBBBBBBABBBBBABBBBBBABBABBABBBBBBABBBBBABBBBBBBBBBABBBBBBBBBBBBAABABBBABABBBBABBBBBABBBBBBBBBABBBBBBABBAABBBBBBBBBBBBABBBBBABBAABABBBBBAABB...

output:

79699
79432
79502
79585
79351
79509
79312
79508
79538
79544
79599
79543
79600
79530
79663
79444
79496
79724
79399
79515
79657
79508
79567
79608
79481
79520
79599
79567
79577
79609
79579
79535
79450
79344
79622
79566
79471
79560
79775
79498
79612
79582
79558
79657
79575
79601
79556
79395
79591
79707
...

result:

ok 637842 lines

Test #33:

score: 0
Accepted
time: 426ms
memory: 50644kb

input:

AABBBAAABAAAAAAABAAABBBBABABAAAABABAAABBABBAAABABABABABAAAAAAAAAAAABBAAAAABBBAABAAAAAAAAAAABAAAABAABABAABAAAAAAAAABBAABABBBAAAABAABAAABABAAAAAAAAAAABBAAABABAAAAAAABAAAAABBBAAAAAABABAAAABABABABABABABAAABAAABAAAAABBBABAABAAAAAAABAAAAAAABAAAAAAABAAABBABAABBBBBABAAAABBAABAABABBAAABABBAAAAABAAABBAABAAAAB...

output:

80610
80439
80514
80367
80404
80360
80712
80593
80285
80488
80477
80344
80399
80653
80372
80406
80495
80422
80493
80315
80469
80276
80512
80439
80523
80732
80727
80515
80568
80700
80468
80507
80568
80632
80552
80570
80309
80536
80434
80570
80303
80596
80557
80420
80292
80560
80545
80281
80619
80472
...

result:

ok 377372 lines

Test #34:

score: 0
Accepted
time: 411ms
memory: 52420kb

input:

AAAABAAABAABBABBBAAABAABAABAAAAABAAABBAABAAAABAABABBBBAAAAABBBBAAAAAABAABAAAAAAAABAABAABABBBBABABABAABBBBABABAAAAAAABBBABAABBBBAAAAAABABBAAABAABBBAAABAABBBAABBBBAAABAABABBBABABBAAABBBABAABBAABABBBBBBAAABBAAABAAAABABBBAAABBBABBABABAAAABABAAAAABBABABABAAABAAABBBABAABBBABBBBAABBAABAABABAABBABAABBAAABAB...

output:

116919
116788
116727
116396
117005
117120
116881
116938
117080
116832
117020
116726
116903
117070
117208
116774
116970
116919
116973
116756
116858
116951
116992
116585
116814
116634
116891
116737
116945
116983
116777
116672
117109
116650
117165
116894
116991
116875
117037
116693
116940
116951
116738...

result:

ok 475301 lines

Test #35:

score: 0
Accepted
time: 796ms
memory: 95268kb

input:

BBBBBBBAABBBBBBBBABBBBBBBBBBBBBBBBBABBBBBBBBBBBABBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBABBBBBBABBBABBBBBABBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

33582
33580
33621
33634
33577
33582
33670
33609
33680
33762
33618
33688
33640
33578
33585
33655
33648
33625
33564
33555
33579
33625
33640
33681
33572
33571
33615
33698
33665
33688
33546
33640
33660
33680
33645
33614
33580
33601
33635
33627
33607
33612
33593
33633
33665
33602
33615
33713
33630
33572
...

result:

ok 603644 lines

Test #36:

score: 0
Accepted
time: 95ms
memory: 15592kb

input:

AAABBABAABAABABBABAAABAAAABABBBAABABAAAABABBAABBBBBAAAABBABBABAABABABBBABBABAAABBBAABBBBBABBBBAAAAABBAABBAAAABABBAAABBAABBAAAABAABBBBAAAAABAAAAAABAABBAAAAABBBBABBABBBAABBBBABABABBAABBBBBBBABABABABBBABBBAAAAAAABBAABBBBBABABABBAAAABAABBAABAABAABABBBAAAABAAABAABAABBABABBAAAAAAABAAAABABBAAAAAAAAAABAAAAA...

output:

26984
27094
27046
26998
26907
26967
26903
27028
27032
27010
26992
26857
26974
26974
26842
26930
26957
26830
26923
26784
26999
26969
26936
27045
26930
27065
27009
27024
26993
26822
27127
26867
27043
26859
27044
26837
27093
26873
26996
26968
26978
26911
26784
26954
26956
26967
26912
27019
27064
26938
...

result:

ok 109107 lines

Test #37:

score: 0
Accepted
time: 860ms
memory: 97152kb

input:

AAAAAAAAAABAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAABBAAAAAAAAAAAAABAAAAAAABAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAABAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAABAAAAAAAAAAABAAAAA...

output:

38676
38556
38601
38658
38602
38587
38628
38581
38650
38565
38674
38719
38617
38638
38662
38611
38587
38613
38518
38704
38586
38658
38628
38585
38682
38606
38597
38627
38638
38541
38664
38681
38594
38628
38575
38610
38599
38589
38620
38584
38624
38632
38626
38566
38633
38593
38662
38557
38688
38665
...

result:

ok 704666 lines

Test #38:

score: 0
Accepted
time: 824ms
memory: 95664kb

input:

BAAAAAAAAABAAAAABBAAAABAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAABBABAABABAABAAAAAAAAAAAAABABBABABAAAAABAAAABAAAABAAAAABAAABBAAAAABABAABABAAAAAAAAAAAAAABABAAAABAABAAAAAAAAAAABABAAAAAAAAABBBAAAAAAAAAAAAABAABAAAAABAAAAAAAAAAAAABAABAAAAAAAABAABAAAAABAAABBAAAAAAABBAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAABAAAAAAAA...

output:

94052
93935
93971
93819
94077
93617
93785
93927
93926
93786
93988
93895
94051
93778
93929
93941
93988
93883
93883
94087
94023
93806
93956
93808
94040
93963
93784
93768
93986
93875
93740
93901
93679
93707
93997
93957
93852
93954
93781
93888
93763
93891
93854
94153
94018
93864
93606
93956
93748
93830
...

result:

ok 623236 lines

Test #39:

score: 0
Accepted
time: 832ms
memory: 96896kb

input:

BBBBBBBABBBBBBBBABBAABBBBAAAABBABBBBBBBAABAAABBBBBBBABAABABBBABBBBBBBBBABBBABBBABBBBBBABBAAAABBABBBAABBBBBBABABABBABABBBBBBBAABBBAABBBBBABABBABBABBBABBBABAABBAAABBBAABBABABBABBBBBBABBBAABABABBBABABBBBABABBBBAABABBBBABBABBBBBBBABBBABAABABBABAABBBABBBBBBBABBBABABBBBBBAABBABBBBABBBABBBBAABBBABABBABABAB...

output:

150262
150018
150463
150250
150398
150071
150351
150190
150492
149761
150452
150106
150589
150449
150029
150130
150076
149919
150154
150105
150274
150225
150141
150188
150098
150130
150070
149776
150179
150121
150059
150206
150254
150312
150130
150025
150494
150123
150436
150358
150180
150187
150345...

result:

ok 688193 lines

Test #40:

score: 0
Accepted
time: 888ms
memory: 101612kb

input:

AABAAAAAABAAAABBAABBBAABAABBABABBABABBABAAAABBAAAAAAAAAABAAAAAABABAABAAABAAAAAAAAAAAABAAAAAAAAAAABAAAAAABAAABAAAAABBABAAABAABAABAAAAAAAABAAABBAAABAAAAAAAAAAAAAAAABAABABAAAAABAABABAABABAAAAAAAAABAAAAAAAAAABABABAAAAABBABAAAAAABAABAABAAAAAAAAABAABAAABAAABAAAAAABAAAABBAAABAABAABABAAAAAAABBAAABAABABAAAAA...

output:

193452
193474
193488
193692
193878
193500
193847
193872
193579
193723
193586
193692
193619
193057
193665
193383
193535
193583
193629
193792
193421
193657
193746
193715
193552
193891
193587
193440
193850
193611
193893
193535
193794
194027
193676
193590
193705
193818
193747
193436
193232
193574
193869...

result:

ok 984168 lines

Test #41:

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

input:

AAAAAAAAAAABAAAAABABAAAAAAABAABAAAAAAAAABABBAAABAAAAABAABAAABBAAAABBAAAAAAAAAAAAAAABAAABAAAAAAAAAAAAAAAABABAAAAAABAAABAAAAAABAAAAAAAAAAAAAAAAAAAABAAABABAAAAAAAAAABAAAAAAAAAAAAABAAAAAAAAAAABBABAAAAAAAABBAAAAAABAAAAAABAAABAAABBAABAAAAAAAAAAAAAAAABAAAABAAABAAAAAAAAABABAAAAAAAABAAAAAABAAAAAAAAAABBAAAAAB...

output:

15203
15363
15304
15197
15288
15232
15233
15292
15277
15278
15260
15256
15176
15126
15291
15326
15177
15205
15291
15249
15300
15298
15234
15255
15192
15155
15251
15212
15262
15308
15243
15208
15300
15176
15223
15261
15308
15313
15173
15207
15308
15187
15200
15334
15248
15248
15328
15285
15178
15237
...

result:

ok 107287 lines

Test #42:

score: 0
Accepted
time: 812ms
memory: 98180kb

input:

BAAABBAAABBABAAAAAAAAAABAAAAAAAAAABAAAAAAAAAAAAAABAAAAAAABAAAAAABAAAABBAAAABAABBAAAAAAAAAAAAAAAAABAAABAABAAAABBABAABAABAAABAAAAAAAABAAAAABBBABABAAABAAABAAAABBABAAABAABAAABABBAABAAABAAAAAAABABBAAABAAABABAAABAAAAAAABBBAAABBAAABBABAAAAABAAAAAAAABABBBBAAABBABBABABAABABAAAAAAAAABAAAAAAABABAAAAABAAABAAAAA...

output:

134603
134587
134446
134413
134616
134512
134568
134179
134467
134404
134499
134215
134395
134359
134499
134289
134431
134372
134401
134444
134447
134454
134272
134117
134371
134491
134068
134158
134320
134430
134436
134621
134491
134389
134380
134409
134227
134312
134280
134372
134400
134365
134422...

result:

ok 774497 lines

Test #43:

score: 0
Accepted
time: 927ms
memory: 101924kb

input:

AAABBBAABAAAAABBAABAAAABAAAABAABAAAAAABABBAAABAABABBBABBABBBABAABBABBAAAAAAAABBAAAAAABABABBAAABAABBAABBBAABBBBABBABBAABABAAAABBBAABAAABBAABABABAAAAABAAABBABAAABAABABBBBAAABBABABBAAABAABAABABAAAAABBAAAAABAAABAAAAABABBAABABAAAAABAAAAAAABBAABAAABAABBAAABAAAAAABBAAAAABAAABAABBBBABAAABAAAAAABAAAAAABAABAB...

output:

233268
233589
233574
233408
233416
233172
233028
233091
233348
233587
233315
233170
233496
233194
233121
232803
233383
233277
233637
233262
233282
233665
233264
233604
233443
233011
232918
233214
233564
233645
233509
233409
233587
233630
232620
233105
233918
233053
232931
233553
233382
233205
233697...

result:

ok 999999 lines

Test #44:

score: 0
Accepted
time: 864ms
memory: 102076kb

input:

BAAAAAAABBBAABAABABAAAAAABABAABABABAAABBABAAAAAAAAAABAAAAAABAAAABAAAAAAAAABAABAAAAABAABAABAAABAAABABAAAAAAAAAAAAAAAAAAAABAAAAAAABABAAAAAAAAAAAAAABAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAABABAAAAAAABAAAAABAAAAAABAAAAABBAAAAAAAABABAAAAAABAAAAAAAAABAAABAAAABAAAAAAABAAABAAABBAAABAAAABABAAAAAAAA...

output:

128710
128572
128506
128670
128829
128595
128493
128920
128735
128644
128860
128719
128589
128380
128856
128362
128850
128624
128536
128542
128463
128540
128593
128627
128586
128546
128657
128389
128655
128717
128518
128555
128758
128454
128567
128525
128559
128397
128553
128477
128400
128513
128423...

result:

ok 999999 lines

Test #45:

score: 0
Accepted
time: 906ms
memory: 101928kb

input:

BAABABAABABAABBAABBABBAAAABAAABAAAAABABBABBAABABABBBAAAAAABABBAAAAABAABBBAAABAAAAABBBBABABAABAABAAAABBBABAAAAAABAAABBAAAAAAAABABAABAAAAAAAAABABBAAAAABABABBABAAAABAAAABABAAABAAABAABAABABBAAAABBAABBBBAAAAAAAAAABBAAAABABAAAABBBBAABAAAAABABABAAABAABBABAAABAAAAAAAABABABABAAAAAABAAAABAAAABABBABBBBAAABBAAA...

output:

232862
232510
232690
232032
232362
232430
232509
232677
232605
232104
232532
232104
232594
232469
232552
232377
232183
232370
232519
232675
232610
232123
232479
232822
232675
232156
232910
232412
232867
232626
232624
232817
232770
232360
232956
232863
232744
232086
232016
232247
232910
232480
232191...

result:

ok 999999 lines

Test #46:

score: 0
Accepted
time: 920ms
memory: 101940kb

input:

BAABBBBBAABABBBAAAABBABBAAAABBBBBBAABBAAABAABBBBBABBABBBABABBBBAAAABBAABAABBBBABBBBBBABAABABBBBAAAABABBABAAABBAAAABAABBAABBAAABAAABBBABBBBAAABBAAABABAABBBBABBBABBBBAABBBBABAAABBBABAAAABBBBABBBABAAABABBABBBBABAABBABBBAAABAAAABBBBBBAABABBBBBBBBBBBBBABBBBAABBBBBBBBBABBABABBBBBBBAAAABBBABBAABBBBBBBBBAAA...

output:

233264
233399
233627
233369
233249
233581
233545
233571
233785
233211
233380
233500
233051
233102
233177
233276
233299
233450
233266
233230
233179
233099
233068
233148
232860
233195
233277
233447
233665
233297
233297
233674
233227
233614
233471
233106
233216
233112
233476
233103
233218
233067
233349...

result:

ok 999999 lines

Test #47:

score: 0
Accepted
time: 925ms
memory: 102156kb

input:

ABABBBABAAAAABBAAABBAAAAAAABBBBBBBAAAAAABAABAABABAAAAAAABABAABBAABBBAAAABAABBAAABABAAAAAABBAABAAAABBABAABAABAAAABBBAABAAAAAAAABBAABABAAAAABBAABAABBAABBAAABBBABBABAABAAABAAAAABBABABABAAAAABABBAAAAABAAABBBBAABAAAABAABBAABAAAAABABAABAAAAAAABAAABABABAABBBAABBAABAAABAAAABBAABBBABBBBAABAAABBBABAABABABAABA...

output:

222142
221918
222094
222066
221843
222108
222351
222488
222414
222357
222107
222140
222042
222061
222339
222269
222352
221759
222627
222642
222276
221897
222098
221762
222553
222359
221921
222435
222200
222077
221913
222590
222057
222419
222313
222287
222480
222255
222174
222555
222566
221977
222086...

result:

ok 999999 lines

Test #48:

score: 0
Accepted
time: 885ms
memory: 102180kb

input:

BBAABBBBBBBBABBBBBBBBAABBABBBBBBBBBBABBBABBBABABBBBBBBBBBBBBBBBBBABBBABBBBBBABBBBBBBBBABBAABABBBBBBBBABBBBABBBBABAAABBBBBAABBBBBABAABBBBBAABBBABAAABBABBBBBBBABAABBBBBBBBABBBBBBBBBBBBBBABBABBBBABBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBABBABABBBBBABBBBBABBBBAABBBBBBBBBABABBABBBBABBABABAABBBAABBBBBBBBBBBBBBBBB...

output:

145398
145524
145407
145659
145193
145743
145514
145344
145515
145668
145341
145431
145659
145490
145373
145355
145594
145505
145361
145420
145605
145297
145241
145611
145386
145330
145600
145505
145426
145480
145501
145680
145732
145490
145503
145398
145707
145496
145614
145280
145487
145285
145497...

result:

ok 999999 lines

Test #49:

score: 0
Accepted
time: 935ms
memory: 101928kb

input:

BBABBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBAABBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

53766
53845
53813
53835
53752
53833
53771
53785
53827
53813
53772
53792
53778
53751
53898
53789
53728
53770
53852
53789
53839
53787
53762
53760
53882
53847
53768
53873
53837
53783
53826
53905
53846
53768
53844
53766
53830
53787
53829
53719
53863
53859
53775
53789
53792
53820
53854
53822
53685
53820
...

result:

ok 999999 lines

Test #50:

score: 0
Accepted
time: 916ms
memory: 102052kb

input:

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBABBABBBBABBBBBABBBABBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBABBBBBBBBBBABBBBBBBBBBBBBBBBBBBABBBBABBBBBBBBBABBBBABBBBBBBABBBABBBBBBABABBBBBBBBABBBBBBBBBBBBBBBBBABABBBBBBBBBBBAABBBBBBABBBBBBBBBBABAABBBBBBBBBBBB...

output:

90393
90396
90248
90261
90382
90365
90323
90180
90360
90372
90359
90309
90199
90465
90124
90557
90327
90379
90386
90386
90333
90499
90314
90258
90490
90337
90284
90332
90562
90508
90313
90454
90378
90585
90268
90458
90396
90272
90367
90315
90308
90484
90498
90494
90384
90452
90459
90562
90294
90304
...

result:

ok 999999 lines

Test #51:

score: 0
Accepted
time: 905ms
memory: 102080kb

input:

BABBABBBBBBBABBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBABBABBABBAABBABBBBBBBBBBBBBABBBBABBBBBBBBAABBABBBAABBABBBBBABBBABBBBBBBABBBBBBBABBBBBBBBBBBBBBBBABBBBBBBBAABBBBBABBAABBAABBBBBBBBBBBBBBBABBBBBBAABBBBBBBABBBBAABBBBBBBBBBBBBBABBBBBBBABBBBBBBBABBBBBBBABBBAABABBBBABBBBBBBABBBBBABBBBBBBBBABBBBABBBBABBBBBBBBB...

output:

139854
139692
140018
139901
139930
139938
139962
139612
139975
139983
139999
139938
139871
139796
139902
139684
140023
140009
139924
139866
139852
139661
139903
139734
140021
139837
139821
139993
140033
139879
139834
139820
139778
139744
139891
139674
139849
139996
139972
139666
139991
140023
139791...

result:

ok 999999 lines

Test #52:

score: 0
Accepted
time: 934ms
memory: 102112kb

input:

BBBBABBAABBABABBAAAAABAABBBABBBABBBBBABBBAABABAABABABBAABBABBABABABBABBBBBBBBAABABBBBBABABBBBBABBABBBAABBBBAABABABAAAABABBBABAAAABBBBABABAABBBBAAABABBAABABBBBBBABBBBBABBBABBAABBBABABABABBAABBAABAABBBBBABABBAAABABABBABABBAAAABBAAABBBABABBBAAAAABABBBBBBBAABBAABABBBBABBBBAAABBBBAABAABAAABABABBBABBABABB...

output:

245766
245819
245973
245368
245858
245971
245849
245650
245935
245857
245846
245894
245883
245771
245873
245868
245957
246204
245942
246635
246061
246411
245962
245866
245924
246048
245831
246365
246085
245714
245675
245902
245466
245678
245702
245759
245835
245773
245621
246025
245751
246006
245895...

result:

ok 999999 lines

Test #53:

score: 0
Accepted
time: 931ms
memory: 101924kb

input:

BBBBBBBABBABAABBBBBBAAABBBBABBBBABBBBABBABBBABBABABBBBBAAABBAABBABAABBAAAABBBABBBBBAABBBAABBBBAAABAAABBABABAAABBBBABAABBBBBABBBAABBBBBBBBBABBBBBBBAABBABBABBABBBABABBABBAABABAAABABBBBBBAABBABBABBBBBBAABAAABBABAABAABBBAAABABBBBABBBABBABBBBBABBBBBAAABBBBBABBBABBBABBAAABABBBBBBBBBBBABBBBBABABBBAABBBBBBB...

output:

212458
213172
212516
212765
212429
212445
212378
212976
212516
212755
212451
212426
212633
212478
212565
212623
212570
212658
212261
212626
212473
212624
212155
212774
212883
212750
212587
212469
212389
212602
212576
212639
212663
212499
212798
212620
212641
212630
212363
212750
212394
212468
212894...

result:

ok 999999 lines

Test #54:

score: 0
Accepted
time: 900ms
memory: 102064kb

input:

BBAABBAAAABBABBBBAAAABBABBABABBABBBAABBBBABBBBABBBBABBBABABABBBBBBAABAAABAABABBBABBAABBAABBBBABBABBBBBAAABBBBABBBAAABBBBBABBABBBBBBBBBBBAAAABBBBAAABBBABBABBABABABABBABBBBBBABABABBABBBBBBBBABBAABBABBBABABBABBBBABBABBABABBABBBBBBABABBBBBBBAABBBAABBBBAAAAABABBBBBBAAABABAAABBAABABBBBBBBBBBAABBABBABABABB...

output:

218654
218857
218909
218825
218717
219157
218791
218501
218688
218842
218526
218652
218564
218969
218537
218553
218420
218741
218327
218685
218588
218821
218558
218870
218552
218559
218649
218839
218810
218366
218556
218353
218937
218927
218793
218612
218722
218806
218564
218669
218844
218624
218617...

result:

ok 999999 lines

Test #55:

score: 0
Accepted
time: 886ms
memory: 101880kb

input:

BBABABBBABBBAABBBBBBBAAAABABAAAABABBAABBBAAABAAABAABBAABABAAAAABBBABABAABBBABBAAABBABBAABBBBABBABABBBAABABABBAAAAAAAAAAAABAAAABBAAAAAABAAAABBBBBAAAAABBBAAABBAAAABAABBBAAABBAABABABBBABABAABAABAAAABBABAABBBABAAABABAAAAAAABBAAAAABBABAABABABABBAABABBBAAAAABBBBABAABAABAAAAABBAAAAABBAAAAAABBAABAABABBBAABA...

output:

245223
244798
245012
245171
244964
245243
245032
244708
244953
244975
245078
244696
245109
245057
245169
245447
245004
245017
245156
244983
244690
245585
245015
245133
245072
245338
245004
244794
244789
245351
245009
245056
245340
245211
244933
245100
245336
244780
245116
244711
244632
245255
244890...

result:

ok 999999 lines

Test #56:

score: 0
Accepted
time: 861ms
memory: 102048kb

input:

AABABABAAAAAAABAAABAABABABBBABAABAABABBABABABABBBBBAAAABBAAABAAAAAABBABBABAABBABBBBAABBAAABAAAAABBABABABBBBBABAABBBBBAAABAABAABBABAAABBAAAAABBABABAAAAAAAABAAABAAAAABAABABAAAAABAABBBABABBAABAAABAABABBAAAABABAABBBBBBBBAABBBAAAABAAABABAABBAABAABBBAAAABABAABBAABABBBAAABABBBAAABBAAABBAAAAAAAAAABAAABBBABB...

output:

243375
243065
243071
243250
243123
243008
243247
243227
243441
243505
243327
243362
243167
243295
243324
243193
242977
243441
243637
243411
243089
243246
243328
243737
242955
243496
243264
242964
243304
243523
243421
243234
243302
243102
243284
243360
243598
243105
243636
243201
243183
243530
243393...

result:

ok 999999 lines

Test #57:

score: 0
Accepted
time: 904ms
memory: 101852kb

input:

BBBBBBBBBABBABBBAABABABBBAABABABABABBABABAAABBAAABABABBABABABABBBBABABBABAAAAAABAABBABBBABABBBAAABBBAAABBABBBBBBBBABBBBAABBBAAAABBABBBBBAABBBAABABABBABBABBAAAABBBBBBABABBBBBBBBABBABBABABBABBBBBBAABBBBAABAAAABBABABABBAABABAABBBBAABBBBBBBBBBBAABBAAABBBBABBBBBABAABABBBBBBBABBBBBBBABBBBBABABBBBBBABBBBAB...

output:

229394
229979
229325
229468
228843
229243
229354
229090
229152
229361
229100
229625
229264
229178
229526
229616
229050
228994
229455
229628
229208
229440
228706
229029
229116
229553
229183
229021
229224
229248
229426
229270
229258
229212
229400
229353
229278
229257
229231
229437
229248
229196
228972...

result:

ok 999999 lines