QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#731271#9571. Border Jump 2ucup-team4435AC ✓1831ms24620kbC++2016.8kb2024-11-10 01:26:442024-11-10 01:26:52

Judging History

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

  • [2024-11-10 01:26:52]
  • 评测
  • 测评结果:AC
  • 用时:1831ms
  • 内存:24620kb
  • [2024-11-10 01:26:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;

#define all(a) begin(a), end(a)
#define len(a) int((a).size())

template<int SZ>
struct hash_t {
    inline static bool initialized = false;
    inline static int MOD[SZ], BASE[SZ];
    inline static std::vector<int> POWER[SZ];

    static void initialize() {
        assert(!initialized);
        initialized = true;
        std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
        for (int i = 0; i < SZ; i++) {
            auto is_prime = [&](int x) {
                for (int i = 2; i * i <= x; i++)
                    if (x % i == 0)
                        return false;

                return true;
            };

            MOD[i] = int(8e5) + rng() % int(2e8 + 228);
            while (!is_prime(MOD[i]))
                MOD[i]++;

            BASE[i] = rng() % MOD[i];
            if (!(BASE[i] & 1))
                BASE[i]++;

            POWER[i].push_back(1);
        }
    }

    static void ensure(int n) {
        assert(initialized);
        if (int(POWER[0].size()) >= n)
            return;

        for (int i = 0; i < SZ; i++)
            for (int j = POWER[i].size(); j < n; j++)
                POWER[i].push_back(int64_t(POWER[i].back()) * BASE[i] % MOD[i]);
    }

    int length;
    std::array<int, SZ> h;

    hash_t() : length(0) {
        h.fill(0);
        if (!initialized)
            initialize();
    }

    template<typename T>
    hash_t(const T &value, int length = 1) : length(length) {
        if (!initialized)
            initialize();

        ensure(length);
        h.fill(0);
        for (int i = 0; i < SZ; i++)
            for (int j = 0; j < length; j++) {
                h[i] += int64_t(value + 1) * POWER[i][j] % MOD[i];
                if (h[i] >= MOD[i])
                    h[i] -= MOD[i];
            }
    }

    hash_t<SZ>& operator+=(const hash_t<SZ> &x) {
        assert(initialized);
        ensure(x.length + 1);
        for (int i = 0; i < SZ; i++)
            h[i] = (int64_t(h[i]) * POWER[i][x.length] + x.h[i]) % MOD[i];

        length += x.length;
        return *this;
    }

    hash_t<SZ>& operator-=(const hash_t<SZ> &x) {
        assert(initialized);
        assert(x.length <= length);
        ensure(length - x.length + 1);
        for (int i = 0; i < SZ; i++) {
            h[i] -= int64_t(x.h[i]) * POWER[i][length - x.length] % MOD[i];
            if (h[i] < 0)
                h[i] += MOD[i];
        }
        length -= x.length;
        return *this;
    }

    bool operator==(const hash_t<SZ> &x) const {
        if (length != x.length)
            return false;

        return h == x.h;
    }

    bool operator<(const hash_t<SZ> &x) const {
        if (length != x.length)
            return length < x.length;

        return h < x.h;
    }

    friend hash_t<SZ> operator+(const hash_t<SZ> &left, const hash_t<SZ> &right) {
        return hash_t<SZ>(left) += right;
    }

    friend hash_t<SZ> operator-(const hash_t<SZ> &left, const hash_t<SZ> &right) {
        return hash_t<SZ>(left) -= right;
    }
};

// source: https://judge.yosupo.jp/submission/42086
#include <algorithm>
#include <cassert>
#include <cstring>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <memory>
#include <queue>
#include <random>
#include <vector>

void SA_IS(const int *s, int *SA, int n, int K) {
  // s 为字符串数组[0..n-1] 必须保证 s[n-1]=0 且为最小值
  // SA 为存储后缀数组[0..n-1]
  // n 为字符串长度
  // K 为值域

  bool *t = new bool[n]; // 类型数组
  int *bkt = new int[K]; // 桶
  int *bkt_l = new int[K];
  int *bkt_r = new int[K];
  int n1 = 0; // LMS-后缀的数量
  int *p1;    //按出现顺序存储所有 LMS-后缀的索引

#define is_S_type(x) (t[x])
#define is_L_type(x) (!t[x])
#define is_LMS_type(x) (is_S_type(x) && x != 0 && is_L_type(x - 1))

  // 预处理每一个后缀的类型
  t[n - 1] = true; // 0 为 S-型后缀且为 LMS-型后缀
  for (int i = n - 2; i >= 0; --i) {
    t[i] = (s[i] < s[i + 1] || (is_S_type(i + 1) && s[i] == s[i + 1]));
    n1 += is_LMS_type(i + 1); // s[0] 必然不是 LMS-型后缀,不会影响
  }

  // 预处理桶的边界
  for (int i = 0; i != K; ++i) bkt[i] = 0;
  for (int i = 0; i != n; ++i) ++bkt[s[i]];
  for (int i = 0, sum = 0; i != K; ++i) sum += bkt[i], bkt_r[i] = sum, bkt_l[i] = sum - bkt[i];

#define indecud_sort()                                                                             \
  do {                                                                                             \
    for (int i = 0; i != K; ++i) bkt[i] = bkt_l[i];                                                \
    for (int i = 0, j; i != n; ++i)                                                                \
      if ((j = SA[i] - 1) >= 0 && is_L_type(j)) SA[bkt[s[j]]++] = j;                               \
    for (int i = 0; i != K; ++i) bkt[i] = bkt_r[i];                                                \
    for (int i = n - 1, j; i >= 0; --i)                                                            \
      if ((j = SA[i] - 1) >= 0 && is_S_type(j)) SA[--bkt[s[j]]] = j;                               \
  } while (0)

  // 将所有 LMS-后缀放入 SA 对应桶的末尾并诱导排序
  p1 = new int[n1];
  for (int i = 0, j = 0; i != n; ++i) {
    SA[i] = -1;
    if (is_LMS_type(i)) p1[j++] = i;
  }
  for (int i = 0; i != K; ++i) bkt[i] = bkt_r[i];
  for (int i = n1 - 1; i >= 0; --i) SA[--bkt[s[p1[i]]]] = p1[i];
  indecud_sort();

  int *s1 = new int[n1];  // 新的字符串
  int *SA1 = new int[n1]; // 存储新的字符串排的后缀数组
  for (int i = 0, j = 0; i != n; ++i)
    if (is_LMS_type(SA[i])) SA1[j++] = SA[i]; // 存储 LMS-子串的相对顺序
  int name = 0;
  // 对所有 LMS-子串命名
  for (int i = 0, prev = -1; i != n1; ++i) {
    int pos = SA1[i];
    for (int j = 0;; ++j) // 无需设置范围,因为 s[n-1]=0 为最小值且不会出现在其余位置
      if (prev == -1 || s[pos + j] != s[prev + j] || is_S_type(pos + j) != is_S_type(prev + j)) {
        prev = pos, ++name;
        break;
      } else if (j != 0 && (is_LMS_type(pos + j) || is_LMS_type(prev + j))) // 到末尾了停止比较
        break;
    SA[pos] = name - 1; // 利用 SA 暂时存储新字符串的 name
  }
  for (int i = 0; i != n1; ++i) s1[i] = SA[p1[i]];

  if (name != n1)
    SA_IS(s1, SA1, n1, name);
  else
    for (int i = 0; i != n1; ++i) SA1[s1[i]] = i;

  for (int i = 0; i != K; ++i) bkt[i] = bkt_r[i];
  for (int i = 0; i != n; ++i) SA[i] = -1;
  for (int i = n1 - 1; i >= 0; --i) SA[--bkt[s[p1[SA1[i]]]]] = p1[SA1[i]];
  indecud_sort();

  delete[] SA1;
  delete[] s1;
  delete[] p1;
  delete[] bkt_r;
  delete[] bkt_l;
  delete[] bkt;
  delete[] t;

#undef is_S_type
#undef is_L_type
#undef is_LMS_type
#undef indecud_sort
}

std::vector<int> get_sa(const std::string &s) {
  int len = s.size();
  std::vector<int> SA(len + 1), s_cpy(len + 1);
  for (int i = 0; i != len; ++i) s_cpy[i] = s[i];
  s_cpy.back() = 0;
  SA_IS(s_cpy.data(), SA.data(), len + 1, 128);
  return std::vector<int>(SA.begin() + 1, SA.end());
}

struct suffix_array {
    std::vector<int> order, suffix_position, lcp;

    template<typename T>
    suffix_array(T str = T()) {
        int n = str.size() + 1;
        order = get_sa(str);
        order.insert(order.begin(), n - 1);
        
        suffix_position.resize(n);
        for (int i = 0; i < n; i++) {
            suffix_position[order[i]] = i;
        }

        lcp.resize(n);
        int current_lcp = 0;
        for (int suffix = 0; suffix < n - 1; suffix++, current_lcp = current_lcp == 0 ? 0 : current_lcp - 1) {
            int previous_suffix = order[suffix_position[suffix] - 1];
            while (str[suffix + current_lcp] == str[previous_suffix + current_lcp])
                current_lcp++;

            lcp[suffix_position[suffix]] = current_lcp;
        }
    }
};

/*
 * Node must have default constructor.
 * Node must have static function merge.
 * Node must have .push and .clear_after_push methods.
*/

template<typename node>
class segtree {
private:
    void build(int v, int vl, int vr) {
        if (vr - vl <= 1)
            return;
 
        int vm = (vl + vr) >> 1;
        build(v << 1, vl, vm);
        build(v << 1 | 1, vm, vr);
        tree[v] = node::merge(tree[v << 1], tree[v << 1 | 1]);
    }

    template<typename T>
    void build(int v, int vl, int vr, const std::vector<T> &arr) {
        if (vl == vr)
            return;
 
        if (vr - vl == 1) {
            tree[v] = node(arr[vl]);
            return;
        }
 
        int vm = (vl + vr) >> 1;
        build(v << 1, vl, vm, arr);
        build(v << 1 | 1, vm, vr, arr);
        tree[v] = node::merge(tree[v << 1], tree[v << 1 | 1]);
    }

    template<typename... Args>
    void _update(int v, int vl, int vr, int l, int r, Args&&... args) {
        if (r <= vl || vr <= l)
            return;
 
        if (l <= vl && vr <= r) {
            tree[v].apply(std::forward<Args>(args)..., vl, vr);
            return;
        }
 
        int vm = (vl + vr) >> 1;
        tree[v].push(tree[v << 1], vl, vm);
        tree[v].push(tree[v << 1 | 1], vm, vr);
        tree[v].clear_after_push();
 
        _update(v << 1, vl, vm, l, r, std::forward<Args>(args)...);
        _update(v << 1 | 1, vm, vr, l, r, std::forward<Args>(args)...);
        tree[v] = node::merge(tree[v << 1], tree[v << 1 | 1]);
    }

    node _query(int v, int vl, int vr, int l, int r) {
        if (l <= vl && vr <= r)
            return tree[v];
 
        int vm = (vl + vr) >> 1;
        tree[v].push(tree[v << 1], vl, vm);
        tree[v].push(tree[v << 1 | 1], vm, vr);
        tree[v].clear_after_push();
 
        if (r <= vm)
            return _query(v << 1, vl, vm, l, r);
 
        if (vm <= l)
            return _query(v << 1 | 1, vm, vr, l, r);
 
        return node::merge(_query(v << 1, vl, vm, l, r), _query(v << 1 | 1, vm, vr, l, r));
    }

    template<typename T>
    int _find_first(int v, int vl, int vr, int from, const T &checker) {
        if (vr <= from)
            return n;

        if (from <= vl && !checker(tree[v], vl, vr))
            return n;

        if (vr - vl == 1)
            return vl;

        int vm = (vl + vr) >> 1;
        tree[v].push(tree[v << 1], vl, vm);
        tree[v].push(tree[v << 1 | 1], vm, vr);
        tree[v].clear_after_push();

        int res = _find_first(v << 1, vl, vm, from, checker);
        return res == n ? _find_first(v << 1 | 1, vm, vr, from, checker) : res;
    }

    template<typename T>
    int _find_last(int v, int vl, int vr, int from, const T &checker) {
        if (from <= vl)
            return -1;

        if (vr <= from && !checker(tree[v], vl, vr))
            return -1;

        if (vr - vl == 1)
            return vl;

        int vm = (vl + vr) >> 1;
        tree[v].push(tree[v << 1], vl, vm);
        tree[v].push(tree[v << 1 | 1], vm, vr);
        tree[v].clear_after_push();

        int res = _find_last(v << 1 | 1, vm, vr, from, checker);
        return res == -1 ? _find_last(v << 1, vl, vm, from, checker) : res;
    }

public:
    int n;
    std::vector<node> tree;

    segtree(int n) : n(n), tree(4 * n, node()) {
        build(1, 0, n);
    }

    template<typename T>
    segtree(const std::vector<T> &arr) : n(arr.size()), tree(4 * n) {
        build(1, 0, n, arr);
    }
 
    int size() const {
        return n;
    }
 
    template<typename... Args>
    void update(int l, int r, Args&&... args) {
        if (r <= l)
            return;

        _update(1, 0, n, l, r, std::forward<Args>(args)...);
    }
 
    node query(int l, int r) {
        assert(std::max(0, l) < std::min(n, r)); // or return node() in this case
        return _query(1, 0, n, l, r);
    }

    // Trying to find first true on the interval [from, n).
    // Returns n if not found.
    template<typename T>
    int find_first(int from, const T &checker) {
        return _find_first(1, 0, n, from, checker);
    }

    // Trying to find last true on the interval [0, from).
    // Returns -1 if not found.
    template<typename T>
    int find_last(int from, const T &checker) {
        return _find_last(1, 0, n, from, checker);
    }
};

struct node {
    int mx = -1e9;
    int min_lcp_left = 1e9;
    int min_lcp_right = 1e9;

    node() {}

    node(int x) {
        min_lcp_left = x;
    }

    void apply(ll delta, int, int) {
        mx = delta;
    }

    void push(node&, int, int) {}
    void clear_after_push() {}

    static node merge(const node &left, const node &right) {
        node res;
        res.mx = max(left.mx, right.mx);
        res.min_lcp_left = min(left.min_lcp_left, right.min_lcp_left);
        res.min_lcp_right = min(left.min_lcp_right, right.min_lcp_left);
        return res;
    }
};

void solve(int /* test_num */) {
    string s;
    cin >> s;
    int n = len(s);

    auto t = s + "#";
    auto reversed = s;
    reverse(all(reversed));
    t += reversed;

    suffix_array sa(t);

    vector<int> dp(n, n - 1);
    int ans = 0;

    const int ITS = __lg(n) + 2;
    for (int it = 1; it <= ITS; it++) {
        segtree<node> tree(sa.lcp);

        int max_r = -1;
        for (int l = 0; l < n; l++) {
            while (max_r < dp[l]) {
                max_r++;
                int pos = sa.suffix_position[n + 1 + (n - 1 - max_r)];
                tree.update(pos, pos + 1, max_r);
            }

            if (max_r <= l) {
                dp[l] = -1;
                continue;
            }

            int max_len = 0, pos = sa.suffix_position[l];

            {
                int cur_max = -1e9, cur_lcp = 1e9;

                tree.find_first(pos + 1, [&](const node &nd, int, int) {
                    int cur_len = min(cur_lcp, nd.min_lcp_left);
                    if (max(cur_max, nd.mx) - cur_len + 1 <= l) {
                        cur_lcp = cur_len;
                        cur_max = max(cur_max, nd.mx);
                        max_len = max(max_len, cur_max - l);
                        return false;
                    }
                    max_len = max(max_len, cur_len);
                    return true;
                });
            }

            {
                int cur_max = -1e9, cur_lcp = sa.lcp[pos];

                tree.find_last(pos, [&](const node &nd, int, int) {
                    int cur_len = min(cur_lcp, nd.min_lcp_right);
                    if (max(cur_max, nd.mx) - cur_len + 1 <= l) {
                        cur_lcp = min(cur_len, nd.min_lcp_left);
                        cur_max = max(cur_max, nd.mx);
                        max_len = max(max_len, cur_max - l);
                        return false;
                    }
                    max_len = max(max_len, cur_len);
                    return true;
                });
            }

            if (max_len == 0) {
                dp[l] = -1;
                continue;
            }
            ans = max(ans, it);
            dp[l] = l + max_len - 1;
        }

        int pmax = -1;
        for (int l = 0; l < n; l++) {
            pmax = max(pmax, dp[l]);
            dp[l] = pmax;
        }
    }

    vector<int> nxt(n + 1, n);
    for (int i = n - 2; i >= 0; i--) {
        if (s[i] != s[i + 1]) {
            nxt[i] = i + 1;
        } else {
            nxt[i] = nxt[i + 1];
        }
    }

    using Hash = hash_t<2>;
    vector<Hash> phash(n + 1);
    for (int i = 0; i < n; i++) {
        phash[i + 1] = phash[i] + Hash(s[i]);
    }

    vector<Hash> shash(n + 1);
    for (int i = n - 1; i >= 0; i--) {
        shash[i] = shash[i + 1] + Hash(s[i]);
    }

    for (int l = 0; l < n; l++) {
        if (dp[l] <= l) {
            continue;
        }

        int r = dp[l];
        if (phash[r + 1] - phash[l] != shash[l] - shash[r + 1]) {
            continue;
        }

        int length = r - l + 1;
        if (length % 2 == 1) {
            int mid = (l + r) / 2;
            int rr = min(r, nxt[mid] - 1);
            int ll = mid - (rr - mid);
            ans = max(ans, ITS + length / 2 + (rr - ll) / 2);
        } else {
            int mid = (l + r) / 2;
            int rr = min(r, nxt[mid] - 1);
            int ll = mid - (rr - (mid + 1));
            ans = max(ans, ITS + length / 2 + (rr - ll - 1) / 2);
        }
    }

    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int tests;
    cin >> tests;
    for (int test_num = 1; test_num <= tests; test_num++) {
        solve(test_num);
    }
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3840kb

input:

3
aaaa
abbaabba
xy

output:

3
4
0

result:

ok 3 number(s): "3 4 0"

Test #2:

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

input:

15
eeee
ooom
bbcb
yyaa
ssdn
wgww
hrhr
exer
hcch
qyyy
lppa
ocvo
orxr
lrjj
pztv

output:

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

result:

ok 15 numbers

Test #3:

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

input:

52
eeeee
oooom
bbbcb
yyyaa
sssdn
wwgww
hhrhr
eexer
hhcch
qqyyy
llppa
oocvo
oorxr
llrjj
ppztv
tnttt
vnvvn
hthhp
jzjzj
nrnrr
gqgqt
uruyu
cdchd
djdhh
ktkfy
piipp
zaaza
uffuq
bvvvb
hkkkk
pcccj
qccpq
wqqaq
appgg
cxxvg
ewfee
peupe
odfof
kdpkh
zotoz
yzkzz
irtrt
vxyxi
dlood
akrrk
nsbbb
rdjjc
bfexb
uxsex
ise...

output:

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

result:

ok 52 numbers

Test #4:

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

input:

203
eeeeee
ooooom
bbbbcb
yyyyaa
ssssdn
wwwgww
hhhrhr
eeexer
hhhcch
qqqyyy
lllppa
ooocvo
ooorxr
lllrjj
pppztv
ttnttt
vvnvvn
hhthhp
jjzjzj
nnrnrr
ggqgqt
uuruyu
ccdchd
ddjdhh
kktkfy
ppiipp
zzaaza
uuffuq
bbvvvb
hhkkkk
ppcccj
qqccpq
wwqqaq
aappgg
ccxxvg
eewfee
ppeupe
oodfof
kkdpkh
zzotoz
yyzkzz
iirtrt
vv...

output:

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

result:

ok 203 numbers

Test #5:

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

input:

877
eeeeeee
oooooom
bbbbbcb
yyyyyaa
sssssdn
wwwwgww
hhhhrhr
eeeexer
hhhhcch
qqqqyyy
llllppa
oooocvo
oooorxr
llllrjj
ppppztv
tttnttt
vvvnvvn
hhhthhp
jjjzjzj
nnnrnrr
gggqgqt
uuuruyu
cccdchd
dddjdhh
kkktkfy
pppiipp
zzzaaza
uuuffuq
bbbvvvb
hhhkkkk
pppcccj
qqqccpq
wwwqqaq
aaappgg
cccxxvg
eeewfee
pppeupe
...

output:

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

result:

ok 877 numbers

Test #6:

score: 0
Accepted
time: 16ms
memory: 3652kb

input:

4140
eeeeeeee
ooooooom
bbbbbbcb
yyyyyyaa
ssssssdn
wwwwwgww
hhhhhrhr
eeeeexer
hhhhhcch
qqqqqyyy
lllllppa
ooooocvo
ooooorxr
lllllrjj
pppppztv
ttttnttt
vvvvnvvn
hhhhthhp
jjjjzjzj
nnnnrnrr
ggggqgqt
uuuuruyu
ccccdchd
ddddjdhh
kkkktkfy
ppppiipp
zzzzaaza
uuuuffuq
bbbbvvvb
hhhhkkkk
ppppcccj
qqqqccpq
wwwwqqa...

output:

7
6
5
5
5
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
4
3
3
2
2
2
2
2
2
2
4
3
3
4
4
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
...

result:

ok 4140 numbers

Test #7:

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

input:

21147
eeeeeeeee
oooooooom
bbbbbbbcb
yyyyyyyaa
sssssssdn
wwwwwwgww
hhhhhhrhr
eeeeeexer
hhhhhhcch
qqqqqqyyy
llllllppa
oooooocvo
oooooorxr
llllllrjj
ppppppztv
tttttnttt
vvvvvnvvn
hhhhhthhp
jjjjjzjzj
nnnnnrnrr
gggggqgqt
uuuuuruyu
cccccdchd
dddddjdhh
kkkkktkfy
pppppiipp
zzzzzaaza
uuuuuffuq
bbbbbvvvb
hhhh...

output:

8
7
6
6
6
5
5
5
5
5
5
5
5
5
5
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
4
3
3
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 21147 numbers

Test #8:

score: 0
Accepted
time: 1132ms
memory: 19520kb

input:

2
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...

output:

99999
99999

result:

ok 2 number(s): "99999 99999"

Test #9:

score: 0
Accepted
time: 1005ms
memory: 17360kb

input:

2
eeegeeeggegegeeeegegeeeeegeeegeeeggeeeggegggegeggeeeeegegeeggeeeggggeggggegegeegggegggggeggggeegggegeeegggeegeeegeeeegeggegeggeggeggegggeeeeggeggggggeggegggeegegegggeggegggeegeeggegeegegggeegegegggegggeeeggeggeeegeeggeeggeggegggeggeegegegeeggggegggggegegggeeeegegeeggeggegggegegeggeegggeeeggeeggegg...

output:

21
19

result:

ok 2 number(s): "21 19"

Test #10:

score: 0
Accepted
time: 696ms
memory: 17304kb

input:

2
egooeoegeeggegeeoegggoeoegeeeoeegoeeeogeoggoggoegoegogooooggoeeeoogooegeooegeeggeeoegeogoggegoegoggogeoogegggogegogeoogoeeeogegeoeoggoogoeeooeeogeoegggggegoeoeeggogogggeggoegeogoeogggegggeoggggooggoeoeeoegoeeggoogggggegooggoeooeoeeooeooggogeogeeoogegegoggeogeooeoggeogegoeogeeogeegogegoogggogegogeg...

output:

12
12

result:

ok 2 number(s): "12 12"

Test #11:

score: 0
Accepted
time: 600ms
memory: 17440kb

input:

2
oeoaooeggegegoeeeaeaoeoeogoeoaoeoaaeooaaogagogeaaoeoooaogooaaooogaaaoaagaeaegoeaaaoggaaaogggaeoaaaegeeeggaeoaoooaoeoeaeggoaogaeggoggeggaeoeogaeaggagaoggoaageeaoaeggaoggoagaeoaeeagoaoogogageoaeaoaggogggoeoagogaoooaeeagoeaaeaaoggaegaoegoaoaeoagageagaagoaegaaoeoeaoaeogaeagoggaoaoaeaaeogggeeegaooagega...

output:

11
9

result:

ok 2 number(s): "11 9"

Test #12:

score: 0
Accepted
time: 418ms
memory: 17252kb

input:

2
ntiaoioraegexnnnnxtxeetoogetixnoegbeitbgnrxbiatabitooeatbiibbinnxrrataxaanxnaetxrroraggriraggoobbxegootgrgterottateonbtgxnxnrgoaanrgnbagetioagnbgrarbexatbggenrtbearrnbgtxaatirtnagoaoibigxxiibtxorxanarrtitrbobxnttroixrenxgobrnbarnaanoxignrengrxroababxtbnbxxeinerobtibbibrngrrerebtabetxgbnioggteaxtra...

output:

5
5

result:

ok 2 number(s): "5 5"

Test #13:

score: 0
Accepted
time: 367ms
memory: 17240kb

input:

2
ojzxseudqfxhvuomjrexifhnelffzyfiprrzforwfkwqedndbhmhnogfcfirkfumbqlbjxlldhlnbizrrlnvcqagfbbdcthlgyjlhujxyytzdzzidtsnfqikankokdickzgvjgyajjmhwxfyaaydlmylhcaasplhgslxgelkidgljigipgbfrfhkigkxefcsgulblhdvbjpovwocxifzwpnwqtpkbslqndgxnwvfjverfyneyqaleydxbkovfgvgminukorptglmlrjqlaubjyedlmtkqvtopvwmfaahrk...

output:

3
3

result:

ok 2 number(s): "3 3"

Test #14:

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

input:

100
eeegeeeggegegeeeegegeeeeegeeeg
eeeggeeeggegggegeggeeeeegegeeg
geeeggggeggggegegeegggegggggeg
gggeegggegeeegggeegeeegeeeegeg
gegeggeggeggegggeeeeggegggggge
ggegggeegegegggeggegggeegeegge
geegegggeegegegggegggeeeggegge
eegeeggeeggeggegggeggeegegegee
ggggegggggegegggeeeegegeeggegg
egggegegeggeeggge...

output:

7
5
6
5
6
6
4
6
6
4
6
10
7
5
10
6
10
8
5
10
7
10
7
6
11
10
8
7
5
5
7
8
5
6
6
10
5
7
8
8
8
6
7
6
9
6
6
6
4
5
5
4
6
8
8
6
6
6
4
9
11
7
5
12
8
8
9
7
5
6
10
6
6
7
7
9
5
7
11
6
8
8
5
5
10
6
9
6
9
8
5
5
6
6
6
8
6
7
9
6

result:

ok 100 numbers

Test #15:

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

input:

500
egooeoegeeggegeeoegggoeoegeeeo
eegoeeeogeoggoggoegoegogoooogg
oeeeoogooegeooegeeggeeoegeogog
gegoegoggogeoogegggogegogeoogo
eeeogegeoeoggoogoeeooeeogeoegg
gggegoeoeeggogogggeggoegeogoeo
gggegggeoggggooggoeoeeoegoeegg
oogggggegooggoeooeoeeooeooggog
eogeeoogegegoggeogeooeoggeogeg
oeogeeogeegogegoo...

output:

2
7
4
5
5
3
4
4
3
3
5
5
4
5
4
4
4
4
5
3
5
7
3
3
3
3
8
3
4
6
4
5
4
3
3
6
3
3
4
2
3
5
3
5
4
4
3
4
3
4
4
4
5
4
4
5
4
3
4
4
3
4
5
5
4
4
4
5
4
4
3
3
3
4
3
5
4
6
6
6
3
6
4
5
3
4
3
4
4
3
4
4
3
3
4
4
4
3
4
4
4
5
6
3
3
4
3
5
4
5
4
3
3
5
7
5
7
4
3
2
3
7
4
4
6
5
5
4
5
4
6
2
2
5
6
6
7
3
2
4
4
4
5
5
6
4
3
3
3
4
...

result:

ok 500 numbers

Test #16:

score: 0
Accepted
time: 1290ms
memory: 15896kb

input:

2
babbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabbababbababbabbababba...

output:

37511
37511

result:

ok 2 number(s): "37511 37511"

Test #17:

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

input:

1
abacbaxyabcaba

output:

2

result:

ok 1 number(s): "2"

Test #18:

score: 0
Accepted
time: 1404ms
memory: 18372kb

input:

2
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

19102
17514

result:

ok 2 number(s): "19102 17514"

Test #19:

score: 0
Accepted
time: 733ms
memory: 18404kb

input:

2
ufgbkfjuuijotymncffyqnefotznsflvlihsxddzsjgkqvixsbtrbsbuooirmgytjbyfmlnqvnympwrrvkpacjouomhssrkcsdzbiijainkqfxyvleigspvnyweivxiaolxeatmaobcfczlicidyiozfhykxdvodanrcvlftjzxminuvvbmahwppjmxkmrfecmschtemfmedyduedbladcptkfjtovhcplarqdtcxhdlxpoqwmxfdveaksfvljgvimldtibzjccstyuwctjrptivddcphgmjjjeiuflqed...

output:

9999
9999

result:

ok 2 number(s): "9999 9999"

Test #20:

score: 0
Accepted
time: 656ms
memory: 17952kb

input:

2
eyqtmnrlcnohlapnzfpwmurpwngttugiqebhrvjsffsnribhchntexexcdlbwvtrdqyuajfrkegfixmewwqdhxpisibcnstuellgywtmngtaxhalgnjylglmdqxiaeqdhmalrvmljuqnrbuhwupcupsjdslnueybojeqhuxtfutscztokzwctikfalpkythkxyzxemizlewncihwjqhxxcxtuhnsebnenijhqrpjthyvqkqwkcqzgenfxeemsqlxnucfpzlbaemvhflhzgrpeckxfrrksbppiwsdghmbpl...

output:

4999
4999

result:

ok 2 number(s): "4999 4999"

Test #21:

score: 0
Accepted
time: 366ms
memory: 17692kb

input:

2
ivpnhczudisccdpuvnpthltbjnauoqjehspenapetoludiarsxftuwpzhvxofdzbmpzfdtuhavxcfdktfoceofowuhngrilioexzrydjrlbhzapcrhkbcbsjafaybzauyttajnsuiiaourefxcsrnafpvnidswelbanfhqtnffscraqfgnwmnbcarmkslrcmspvircgzjkztmztgmrqiopgbzxjhlrzrhqxrkyzclznfzqdqrzamvojicilyhyfqieoxygumfodmnyxkpzigpokngvqqtruhgzyngcuybf...

output:

5
5

result:

ok 2 number(s): "5 5"

Test #22:

score: 0
Accepted
time: 356ms
memory: 17612kb

input:

2
dcdyihlmsvlnewvitybmgqindedypovodrhvsomrhbtzokrvojunhvvegffukygrchxmzbuntugnunmloxiesdjbrqvfcitarlcdouhfktwpglyykuehlwxudcninuwzpaiahtbskewyozqwidlcprkrbpcdqqtluodfuttltpzxmmfcsihavyywecvugaojtvuqoadvsexnoohddzeyqbafvsxwfolxawigojpliretadebcgbwkrsjkzrqtzpdnsphmhdvreyslexnhhqkflumwnkhmfyufbpiokneiy...

output:

4
4

result:

ok 2 number(s): "4 4"

Test #23:

score: 0
Accepted
time: 1432ms
memory: 24508kb

input:

2
hbbhbhhbbhhbhbbhbhhbhbbhhbbhbhhbbhhbhbbhhbbhbhhbhbbhbhhbbhhbhbbhbhhbhbbhhbbhbhhbhbbhbhhbbhhbhbbhhbbhbhhbbhhbhbbhbhhbhbbhhbbhbhhbbhhbhbbhhbbhbhhbhbbhbhhbbhhbhbbhhbbhbhhbbhhbhbbhbhhbhbbhhbbhbhhbhbbhbhhbbhhbhbbhbhhbhbbhhbbhbhhbbhhbhbbhhbbhbhhbhbbhbhhbbhhbhbbhbhhbhbbhhbbhbhhbhbbhbhhbbhhbhbbhhbbhbhhbbh...

output:

32768
32768

result:

ok 2 number(s): "32768 32768"

Test #24:

score: 0
Accepted
time: 1394ms
memory: 24620kb

input:

2
abacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabagabacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabahabacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabagabacabadabacabaeabacabadabacabafabacabadabacabaeabacabadabacabaiabacabadabacabaeabacabadabacabafabacabadab...

output:

34418
34456

result:

ok 2 number(s): "34418 34456"

Test #25:

score: 0
Accepted
time: 1474ms
memory: 18780kb

input:

2
abbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabba...

output:

32768
32768

result:

ok 2 number(s): "32768 32768"

Test #26:

score: 0
Accepted
time: 353ms
memory: 17576kb

input:

2
abcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcacababcbcaabcbcacabbcacababcabcbcacabbcacababccababcbcabcacababccababcbcaabcbcacabbcacababccababcbcaabcbcacabcababcbcaabcbcacabbcacababca...

output:

2
2

result:

ok 2 number(s): "2 2"

Test #27:

score: 0
Accepted
time: 320ms
memory: 17504kb

input:

2
abcdbcdacdabdabcbcdacdabdabcabcdcdabdabcabcdbcdadabcabcdbcdacdabbcdacdabdabcabcdcdabdabcabcdbcdadabcabcdbcdacdababcdbcdacdabdabccdabdabcabcdbcdadabcabcdbcdacdababcdbcdacdabdabcbcdacdabdabcabcddabcabcdbcdacdababcdbcdacdabdabcbcdacdabdabcabcdcdabdabcabcdbcdabcdacdabdabcabcdcdabdabcabcdbcdadabcabcdbc...

output:

2
2

result:

ok 2 number(s): "2 2"

Test #28:

score: 0
Accepted
time: 319ms
memory: 17488kb

input:

2
abcdebcdeacdeabdeabceabcdbcdeacdeabdeabceabcdabcdecdeabdeabceabcdabcdebcdeadeabceabcdabcdebcdeacdeabeabcdabcdebcdeacdeabdeabcbcdeacdeabdeabceabcdabcdecdeabdeabceabcdabcdebcdeadeabceabcdabcdebcdeacdeabeabcdabcdebcdeacdeabdeabcabcdebcdeacdeabdeabceabcdcdeabdeabceabcdabcdebcdeadeabceabcdabcdebcdeacde...

output:

2
2

result:

ok 2 number(s): "2 2"

Test #29:

score: 0
Accepted
time: 1752ms
memory: 19784kb

input:

2
foffofoffoffofoffofoffoffofoffoffofoffofoffoffofoffofoffoffofoffoffofoffofoffoffofoffoffofoffofoffoffofoffofoffoffofoffoffofoffofoffoffofoffofoffoffofoffoffofoffofoffoffofoffoffofoffofoffoffofoffofoffoffofoffoffofoffofoffoffofoffoffofoffofoffoffofoffofoffoffofoffoffofoffofoffoffofoffofoffoffofoffo...

output:

39304
39304

result:

ok 2 number(s): "39304 39304"

Test #30:

score: 0
Accepted
time: 1723ms
memory: 19732kb

input:

2
jljpjljjljpjljljpjljjljpjljpjljjljpjljljpjljjljpjljjljpjljljpjljjljpjljpjljjljpjljljpjljjljpjljljpjljjljpjljpjljjljpjljljpjljjljpjljjljpjljljpjljjljpjljpjljjljpjljljpjljjljpjljpjljjljpjljljpjljjljpjljjljpjljljpjljjljpjljpjljjljpjljljpjljjljpjljljpjljjljpjljpjljjljpjljljpjljjljpjljjljpjljljpjljjljp...

output:

39325
39325

result:

ok 2 number(s): "39325 39325"

Test #31:

score: 0
Accepted
time: 783ms
memory: 17904kb

input:

2
wwwwwwwvfvfwfpfwwawwfawwfvfwwfwwwsffwwfwwffvwawfvwvwwvfppwffvpwwvwwvfwwwwffwfawvwwwwwvvffawfwpwwwvwwvfvwwwvpwwwfwfwwawvvawfwwwwvwwvffwwwsvfwwffwwwsffwvwwaavfwwfwffwfpwwwwwwwffwwwwwvvfwfvwwwfwwwwfwfwfawwwwfvwfffvawffwwaffaffffwwvefwaffvwwwwwwawwpwwvwwwvwfvufaawwfwwfwvwvwvvwwwwwfswwwfwfvfwwsfwwwfwwf...

output:

17
15

result:

ok 2 number(s): "17 15"

Test #32:

score: 0
Accepted
time: 962ms
memory: 17280kb

input:

2
cchcihcccccciccihhcciccfckiccccciccccccichcicccciciczcciciccciiciccfcchccchiccccccccicicccccicicccccickcccciihccciihciciiiiihicciichicciccccccicccihhcciccccklhccccccciccccccccccicciihcccccccccccccccciccciiccccccccchckhcchiiciccccccchcicccfcccccccihckchiccccicccfciiccccichccccchicchcccikccchiccccic...

output:

29
23

result:

ok 2 number(s): "29 23"

Test #33:

score: 0
Accepted
time: 1099ms
memory: 17424kb

input:

2
lllalllllallllllllllllalalllllalllllalalblaalslallllllllallllalalllllllllbllllllalllallllllllsbblallalalalbaallallalaalbllbllllllllaallllllllbllllllsalllalbllllllllllbllalllllllalllaalalllllllllllllllllallalllllllalllallllllallblallllllllllalbabllballllllllaalllablllllalalllllallalblllallallllllll...

output:

42
36

result:

ok 2 number(s): "42 36"

Test #34:

score: 0
Accepted
time: 708ms
memory: 17572kb

input:

2
bbacaccabccacbabbbcbbcaabacaacbbaabacbaabccccbacaaccbacaabaacccacbcbccbabcbbbbbbcbaccabacabbcbcbbabbcaacbbbcbaccaccacaaaccbbcaccaaaaacaaabbacacbacccabbabbaabacacbaccabbbcccbbbccccccababbbacbcbcbbbcbcccccaabcccbcbaabcccbbbbbbacaccbccbccccbbccbaabcbbcbbbbccbbaacaaababccccacbbacbcccbbaaccccbcccabacca...

output:

12
10

result:

ok 2 number(s): "12 10"

Test #35:

score: 0
Accepted
time: 524ms
memory: 17324kb

input:

2
effaeacaeffeecdfafeacbbdfcdbeafbeceedbcbfdaafacfbebfdfbccdcadfcefceaafbffdcbccbfbcdbebfcbeaffcdaeabbfcdccaaadecccdccecdabeeecfeddecadafbdceafcfcbfeacbdcfcdaaddfaacffeacabaddbebdebbacedccbdccfbafacbbfaeedadeeecaffcefdccefeafdfdbcdbcaaaebbfceacfeedeecadefbfebdaddcbccbdcafaeecbbdbddcddabbbdaaefcdaccb...

output:

9
6

result:

ok 2 number(s): "9 6"

Test #36:

score: 0
Accepted
time: 444ms
memory: 17652kb

input:

2
gfbjegbhicjdedfiihggdcghdjgafafeggfeffajjhgfhjcchhbghiiejcbedhbgaajgbbiadiahcifhahbihcdiehdciihhecccifdcgbefcghfhfcedacfaafiaigibbfiagdbbeddidegbfagffjifjghjdgfehejbiagdabcihajbcgdebefbfcfddhgfibdfjahiagdahgdbjbijggeajigibbdajijbabhiihchhfcdagfiiggfegbagcdbfiibgijeedfebbeegidfhggeijhaagfjiehcaehed...

output:

6
5

result:

ok 2 number(s): "6 5"

Test #37:

score: 0
Accepted
time: 535ms
memory: 17484kb

input:

2
ababccabacccbccbacbabaacccacbaacbbbccbbbbcbcbbbacaccbcabaaccbbbbaaaabbabbbacaacacabcaabaacccccccacbcababcbacccbcbbbaaababbbcaccaaabccbaacababccabacccbccbacbabaacccacbaacbbbccbbbbcbcbbbacaccbcabaaccbbbbaaaabbabbbacaacacabcaabaacccccccacbcababcbacccbcbbbaaababbbcaccaaabccbaacababccabacccbccbacbabaac...

output:

8
10

result:

ok 2 number(s): "8 10"

Test #38:

score: 0
Accepted
time: 359ms
memory: 17412kb

input:

2
cafbedceafdfbcabaabbdeacfeecedefbedbddabdffececcaebcbcfaaadedadeedafafacaabdebcdbbbcebdfcebbcdacbacfcaedfcfedbcebebdcecfaccffbefefbcbacfacafbedceafdfbcabaabbdeacfeecedefbedbddabdffececcaebcbcfaaadedadeedafafacaabdebcdbbbcebdfcebbcdacbacfcaedfcfedbcebebdcecfaccffbefefbcbacfacafbedceafdfbcabaabbdeac...

output:

4
4

result:

ok 2 number(s): "4 4"

Test #39:

score: 0
Accepted
time: 305ms
memory: 17336kb

input:

2
ehdaahhcijcaajdgcaficajhfffaieibciddcccajbgefiaagghighhefebibjfedihcdcebfgchhddeddgbhgjihcieijiiibgjdaiaehejbcbchbdefjgdajadjefdgcaejbeedehdaahhcijcaajdgcaficajhfffaieibciddcccajbgefiaagghighhefebibjfedihcdcebfgchhddeddgbhgjihcieijiiibgjdaiaehejbcbchbdefjgdajadjefdgcaejbeedehdaahhcijcaajdgcaficajh...

output:

3
3

result:

ok 2 number(s): "3 3"

Test #40:

score: 0
Accepted
time: 382ms
memory: 17396kb

input:

2
bbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbbcbbbbaaabbacbbb...

output:

5
4

result:

ok 2 number(s): "5 4"

Test #41:

score: 0
Accepted
time: 206ms
memory: 17468kb

input:

2
haechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjcfehaechbdajjhjc...

output:

2
2

result:

ok 2 number(s): "2 2"

Test #42:

score: 0
Accepted
time: 1504ms
memory: 19524kb

input:

2
gfgqgfgrgfgqgfgpgfgqgfgrgfgqgfgtgfgqgfgrgfgqgfgpgfgqgfgrgfgqgfgtgfgqgfgrgfgqgfgpgfgqgfgrgfgqgfgtgfgqgfgrgfgqgfgpgfgqgfgrgfgqgfgtgfgqgfgrgfgqgfgpgfgqgfgrgfgqgfgtgfgqgfgrgfgqgfgpgfgqgfgrgfgqgfgtgfgqgfgrgfgqgfgpgfgqgfgrgfgqgfgtgfgqgfgrgfgqgfgpgfgqgfgrgfgqgfgtgfgqgfgrgfgqgfgpgfgqgfgrgfgqgfgtgfgqgfgrgf...

output:

49999
49999

result:

ok 2 number(s): "49999 49999"

Test #43:

score: 0
Accepted
time: 1622ms
memory: 19724kb

input:

2
vgvjvgvpvgvjvgvavgvjvgvpvgvjvgvfvgvjvgvpvgvjvgvavgvjvgvpvgvjvgvzvgvjvgvpvgvjvgvavgvjvgvpvgvjvgvfvgvjvgvpvgvjvgvavgvjvgvpvgvjvgvnvgvjvgvpvgvjvgvavgvjvgvpvgvjvgvfvgvjvgvpvgvjvgvavgvjvgvpvgvjvgvzvgvjvgvpvgvjvgvavgvjvgvpvgvjvgvfvgvjvgvpvgvjvgvavgvjvgvpvgvjvgvmvgvjvgvpvgvjvgvavgvjvgvpvgvjvgvfvgvjvgvpvg...

output:

49151
49151

result:

ok 2 number(s): "49151 49151"

Test #44:

score: 0
Accepted
time: 1607ms
memory: 20008kb

input:

2
lvlblvlqlvlblvlolvlblvlqlvlblvlelvlblvlqlvlblvlolvlblvlqlvlblvlalvlblvlqlvlblvlolvlblvlqlvlblvlelvlblvlqlvlblvlolvlblvlqlvlblvlrlvlblvlqlvlblvlolvlblvlqlvlblvlelvlblvlqlvlblvlolvlblvlqlvlblvlalvlblvlqlvlblvlolvlblvlqlvlblvlelvlblvlqlvlblvlolvlblvlqlvlblvlclvlblvlqlvlblvlolvlblvlqlvlblvlelvlblvlqlv...

output:

34464
34464

result:

ok 2 number(s): "34464 34464"

Test #45:

score: 0
Accepted
time: 1774ms
memory: 19624kb

input:

2
cccdcccdcccdcccdcccfcccdcccdcccdcccdcccfcccdcccdcccdcccdcccfcccdcccdcccdcccdccccccdcccdcccdcccdcccfcccdcccdcccdcccdcccfcccdcccdcccdcccdcccfcccdcccdcccdcccdccccccdcccdcccdcccdcccfcccdcccdcccdcccdcccfcccdcccdcccdcccdcccfcccdcccdcccdcccdccccccdcccdcccdcccdcccfcccdcccdcccdcccdcccfcccdcccdcccdcccdcccfc...

output:

49995
49995

result:

ok 2 number(s): "49995 49995"

Test #46:

score: 0
Accepted
time: 953ms
memory: 17248kb

input:

2
vovvzvvovvzvvvzvvzzzvzvvzvvvzvvozvvzzvvvvovzvvvvvvzvvvvvvzzvvvovvvvvovvzzvvvzvvvvkovvvzzvvzvvvcvvzvvzvvvvvvvvvovzvvvvvzvvvzvvkvzzvzzvvvvvvvzvvvvovvzzvvvvvvzvovvvvvvzvvovvvvvvzzvzkovzkzzvvzvvvzvzvzvvzvvvvvovkvvvvzozvvzvvvvzzwvzvkzvzvvvzzvvvvvvvvvvovvvzkvzvvzvzvvvzvvzzvzvozzvwvvzzvvovvvvvvvzvvvvvovo...

output:

27
27

result:

ok 2 number(s): "27 27"

Test #47:

score: 0
Accepted
time: 953ms
memory: 17188kb

input:

2
nnnnngnqnnqnnnnnnnnqnnnnnngnggnngggnqgqgqnnnngnnngnqnnngqgynngwnnnnngggggnynggngnngnanqnnnnngnnnnngngnqnnnnngnnnqggnnnnnagnngnggqnnnnnnngnngnnnnnnnnnnnqnnnngnnnnannngngngnnqnnnnnnnnnwannnnnnngnnnnnngnqnngnnnnqnqnnnngnnngnnngnngnnnngngnnnggnznqnnngngngqnnnnnnngnqgagnnngnnnqnnnnnngnngqgnqgnnqngggnnn...

output:

23
25

result:

ok 2 number(s): "23 25"

Test #48:

score: 0
Accepted
time: 953ms
memory: 17304kb

input:

2
rrrrrrrrryfrfrrrrfrffrrryrrrfydryoyroyfrrrrrryrrdrryrryrfrrfrrffrfrrfrrffyrrrrrrrrrryrfrffrfrrfrrrrrrrfrrfrrrrrrrffrrrrrfrrrfrfroroyrfyrrrfrfrrrrrrfrfrfryffrrorrrrrfryrrrfyfrrryfrrfryrrryfrrrrffrrrfyrrffrrrrrrrrrrrdrrfyrrrrffffrrfyrrrrrryfrfrrrfrrrrryfryffrrrrrryfrrfrfrffrrdrfrffrrrorrfrrrorrfffrf...

output:

27
27

result:

ok 2 number(s): "27 27"

Test #49:

score: 0
Accepted
time: 246ms
memory: 16148kb

input:

100000
z
e
l
n
j
i
l
j
q
f
p
j
a
c
x
s
v
u
f
c
g
t
f
n
q
r
h
y
w
m
f
q
e
m
y
k
g
e
s
s
b
r
v
g
y
v
w
z
x
t
r
n
z
y
l
w
w
x
a
g
b
a
e
h
u
v
s
y
r
x
d
t
d
p
e
s
o
w
x
q
r
p
h
v
c
i
o
i
v
w
s
a
k
q
a
z
h
l
q
x
e
n
c
n
u
i
t
d
q
v
y
n
x
r
j
u
r
s
w
x
l
p
r
z
m
c
o
e
u
i
e
y
u
i
d
c
n
o
b
i
m
m
a
m
k
k
f...

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
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
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
...

result:

ok 100000 numbers

Test #50:

score: 0
Accepted
time: 236ms
memory: 16076kb

input:

6001
euaixlmvadbpevjhnlcsnhdgcemnmtyfilyxaybidwgiptoevvomzbsmtovcjxvspnzoqbcjqjgwckfy
zm
vlf
ny
koog
dmsnhrdksmwos
rdz
ozqfyxvqz
xxpbjlrmrijtkttngozukt
dgksww
ibwyrsfjvkyhvqyhowmblilzqloryhvy
kglvivbokvkzktpofu
kquuufonscc
ubnlwlrzkgxs
pknkgtkipoabs
o
eu
wenaarskkhiutwtvoeddbcucnqxojfykakqgeivybxmib...

output:

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

result:

ok 6001 numbers

Test #51:

score: 0
Accepted
time: 263ms
memory: 16308kb

input:

301
oxodofzcvwlpqdmqacwookn
hbzxcbarhkzvsxpuojpowprdybaogiubumdapxmrguptwhfwredcnuxggsucefgslpfwmjvatolqafqnmthjswgqowmiiivezwfphcvwxldypzucwfvpwlhfrqymjvymudkezwapwsrfdvitkqsvfvgxzazbxhbpgtmtthmgisopuenfcafqjjdbyvmeqcxgqljthjzfctlpytqnytiihuhkelrjwqqpczbmzgnnxbykzyahkrlvyibulosxdjsehcmveixnzruirrqd...

output:

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

result:

ok 301 numbers

Test #52:

score: 0
Accepted
time: 1539ms
memory: 17420kb

input:

2
tliyfmwnwnxwvzwriubuspwqczypwmujdfoqrushlhgvqnqanqzydlbiwlryoahrouacuswtwivqxxqdynebljjahlmwbvhwatwxtpofpgllbntszjxmwleixjbyzbbnixxzwbsdcyzxmvneoqiquvsqvyjyhhbmpcclhlftfdtrefcjtlfhmuocurwosqtplcxsinrvaxbrahteypivdwtwmufmmedzsnaalzdgnkhffbnooephryrqtnxgqzjnzywlawyapnperyoxjkiglffgcuswrsbjbwyecnwnye...

output:

19
50

result:

ok 2 number(s): "19 50"

Test #53:

score: 0
Accepted
time: 1646ms
memory: 19008kb

input:

2
qtvyigvzjcibaqvdooncntfixbwgibzrbkjpwfrzwhaqkmcqzixpdojdxhklnyzaehzwubqcfdgikjhosobectzngttityjreekbpuynsjzgsspjnntwbnnwliaqgxpzmhskhauxakxavkrtqpbodcoxznprrqquuwwnfobgyyqqsntwjuobuyltijusfzwyythcqtljpfmbzhxreotaqurewlqxocyzrrsyiikvlvumurddzouxgraycoyafvfuklugnbtcqnbbkwfptxphlfgsvlurcqzexbacsynugo...

output:

24944
53

result:

ok 2 number(s): "24944 53"

Test #54:

score: 0
Accepted
time: 1497ms
memory: 17544kb

input:

2
dyqrxwqoqvqzcnxrhiuyypiczmkwrkiggayvhczajbxzkqxcuamrkigvspsymszexpnviwpxtabkwmizpudqwesoyzikbaizbfrcwpsthhsijtukirpjmsjdrivpiwblqlvwkbbayrlzucmljtewlhjlwadnjlbsepgjzkjpgoaasbcndmtoqxvyaswexkhnujyexbyhfinqkmkeqltrtabfnrtjpzcckvcqmxcowaqfxadoxloaycpqnfxjogjfdxibiiwewtnomyooqygeyaprrokeeqnqmjokejaqnz...

output:

7051
16

result:

ok 2 number(s): "7051 16"

Test #55:

score: 0
Accepted
time: 1548ms
memory: 17724kb

input:

2
smuwxdlpllsfmtobjosrbngipyarpjujtxrskuovthdfkdcosrwplanerzpkzsmcdnrjiihytkidevgiacknjpkilvwxktimrwasnkaedpfzxcjxfqdjskonrllvnhacmaghosadfodginjodbvhntnbqrvnujdiiptlznuzgnovnyqdupuabhvwbtxlxzqkpeyoopmlvgfytvxtzfdcofazcixxddbrlvvceyyvqqzixlrzcnhyinqtpjcctyheoepusonwmyggbmybeoiduzpetqonbhrxgwjdcdywmn...

output:

21
47

result:

ok 2 number(s): "21 47"

Test #56:

score: 0
Accepted
time: 1831ms
memory: 17652kb

input:

2
snfkjadzedhysnhkiymwvhgzvsnrtfobnuwtrmnfphipliqgkqgjsvnczddszeifzufsoysyrnxkatwtebckgzirjpnmbpnqadnoliqrwxgxvmxcebtamtziqdvnkgvejzjcmahmqfglzpvlouwxukmphkijecqfdatfrdtkgeubqjnvsgegyakdwppdpmrlzqkompyisxslixzdvwfyhdvexskkwgvqneawscbofumifhmdymfmaxkvhflgwwjdnwfbwikyvbgvpglbsgzbhysbhqbtfwyxftpqqhdgub...

output:

49
38

result:

ok 2 number(s): "49 38"

Test #57:

score: 0
Accepted
time: 1722ms
memory: 18736kb

input:

2
htjsygicjcwqhpmbwcllabxhbpzvnsbjxkhlyszdhpfsxarslhmefwreazhfofpdbjtiohiasafybpozkxzzxfdpqsbwrcwbzbbrbdbzswaiviutcdvzxuphuyjojjdwyjslkaifucgruaiywvkwhgsupyzhynsejdllxkknbifesyriilmizxhaywkukglludidlpojglnlrxptartamyqokbjzgtzhxiktaagfnjlghmofoklpoutfuisyvvfcjxliwqpuaangkipezvethmvojrrojfvgzanughhqvn...

output:

26444
49

result:

ok 2 number(s): "26444 49"

Test #58:

score: 0
Accepted
time: 1618ms
memory: 17768kb

input:

2
oujbuxdmxulyepaticecfzcqteeauquvpabvhiqhyfunlyjklujrksneaxtecjibnxvypynlbdumrzvgcffvggvrsfbkmirigbykpgnfslbmrrunuaesyzgdblbxeqsamshslyrtagbddbddeaxlpmiqnevnfijlaagyksnmmxjbmssduvajzkhyrrpgrworidhtlkjnvhqvzhphuxnquabymheneukwsullmhyoxqovittinrbibtoekiwrfksupvrcxcpdmctcdudzmwpuleluvdnxzrsgarvsicszvq...

output:

51
33749

result:

ok 2 number(s): "51 33749"

Test #59:

score: 0
Accepted
time: 1566ms
memory: 17476kb

input:

2
rknhypvpgxzggcixotxntyzjfmjvwgpefckhzlmnoykvlanmmibvikmfabevnfajyqudxycahutfvaskzevlksfvpydbfpvwxjrulzncfxjvqxsukwqgwbcwfuzbeqqnsbuxqymaejlrnnnjeggsocmybputwrzaneoigkkpxvpfdwibqkwhueghghklstqllrjtiybrdotceryggihpbiwazxwllezbslzrwbbssobvbzrvsqhfzpmgqcmghdwwrmhrycedmchnxeledmgshqhlsekiktomkyuirujeic...

output:

16
2276

result:

ok 2 number(s): "16 2276"

Test #60:

score: 0
Accepted
time: 1315ms
memory: 18216kb

input:

2
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

output:

11626
12595

result:

ok 2 number(s): "11626 12595"

Test #61:

score: 0
Accepted
time: 1335ms
memory: 18500kb

input:

2
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

output:

17270
12438

result:

ok 2 number(s): "17270 12438"

Test #62:

score: 0
Accepted
time: 1075ms
memory: 17568kb

input:

2
pyigpguhsdafmsufbsuosigtjkomaunwlbsgpbtosmbmvbezecxoeknqgthmqvwogftsgnjbeezbfzdilerxhxclrhgmybfvaswrshhmjdjwhjoqjvdidafmkyxcfvbxsurmhesqyccyhbaengjcymgnvxszrwmksesiamybvkgrpczdikveuqkyeppzhzknqpugcoaicxpoqntzfzqocqqjrdkaebkvdhofhtbqvkbztqufvcfpldcbfvgtyhxvcljmeriymdvqgfublnpldxxupgvnbdpvuywujwkulc...

output:

29
17

result:

ok 2 number(s): "29 17"

Test #63:

score: 0
Accepted
time: 1200ms
memory: 17720kb

input:

2
tztgugjmxgxzgxzdwsjhckljncqzgvcvcayfqxmibxvtssmmbvwjnnafuckosccexlprgiahnywcvbwdgmatdytpizqsojgsxeqdjzijnocjghttzpbnkdkkvduybiauioqdnirmxhscdubwlofizkjhnxijwlbqqnhbhnprfgsgjpaaoqooldnnsfugmspmmqdrkuhguawqzdqbhqtzxwocejvutfkttzqdmqhkoocyagmewiyqfbtdjlibhhtaqywjhizyhtmdrlaydhitxrzqqbnxhdravkmcxqtmuu...

output:

28
18

result:

ok 2 number(s): "28 18"

Test #64:

score: 0
Accepted
time: 1013ms
memory: 17652kb

input:

2
jgvxdrmxawlmijubmrhrztyvnblfmrzbsluqhwnclaejnbytpphhirnechzsncxuyeczbunlnzqvcflabiveztzygrlagubwxpagyeztigejcseyxajlxbmypnakhvmnijtalmxawzurlwzaelpzpdyajshanfrecnwzhvdylkznhzerbbekronotqjuuwplioidzgkarympwnipjgbhnzktutlmqbzllvgraiaditvruqphyvhgydhmcpasxuwtthqhfeaatqpqctesyvmcjfyflaqrhkaduoztygjipj...

output:

19
15

result:

ok 2 number(s): "19 15"

Test #65:

score: 0
Accepted
time: 1158ms
memory: 17592kb

input:

2
klssqcrjefikabhfhrlfjpdamsajxwzrzicmrqqimpeyzbpuyvptdferycgazgbvkjivipohpkuxbrmvugxhionqzdrkftedewxcfmoqyeywehjakzfarrfkmcjprpbzvhnxbcntgblwmassxkojvuizizozyjwjvwhgezftyxwunxtkuafpkmpzhlsvhedwxiozawkhlkhqzizjnutobzaeikhfuejdcpuyhouszgegiywegkhcekoglyvpcwbtqvknhevnnghngrdqnfdlrnbnngwyncwsbvcxbueyka...

output:

26
20

result:

ok 2 number(s): "26 20"

Test #66:

score: 0
Accepted
time: 1230ms
memory: 17636kb

input:

2
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh...

output:

3583
4600

result:

ok 2 number(s): "3583 4600"

Test #67:

score: 0
Accepted
time: 1182ms
memory: 17400kb

input:

2
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm...

output:

8186
3383

result:

ok 2 number(s): "8186 3383"

Test #68:

score: 0
Accepted
time: 971ms
memory: 18000kb

input:

2
kiedsgdswrdfwyzyxasfzdmgcyepwzptnidkvmkgferpmkrwrclndrgdghcqqgvysjfyapcweqzrrovgcslkhyuzxaqjkzaybdicrbxiagjnqhcjjnrnjyqpcscfqgvvjxzqkcfqxevgsmuhlobnoagqoksgtnmlnpbnvpfpxsyholknyrkxgigjclqriobmphnzavxoddbgzldcmrurgajwopjzimqnbnognlizjrkpxvvzbmccexwysxjgrgieuuqukwsnxkzhywkjfyfnbbzbukdbbjlowciquprhqi...

output:

28
18

result:

ok 2 number(s): "28 18"

Test #69:

score: 0
Accepted
time: 978ms
memory: 17956kb

input:

2
mmpiwcoleevlwjvnhsabdqacdhjinjtmdtpwuxilpevwqagtjkmbzikbxvxvwspynkcqbbepkqwtlxxvjacigfhjsbpmhlfuulqwuhiljievgwabxbofktccoecpgxeyczprabcqplajlwztdccdfzdhivemvqmcytizziyvofzmxrrbmzajutdmbhloaomkmbvortxjkhsvvwaxftnwtwjzpstmzphrmpgaorskgdxuzassjtepmknmmifehlbwvdqjyugqcscpiphypbzrdwpxzdwjiqswcjjnltawoo...

output:

28
18

result:

ok 2 number(s): "28 18"

Test #70:

score: 0
Accepted
time: 901ms
memory: 17884kb

input:

2
xncrwqwwemxswhlbqkgbfwckgkizefjkldyscppufedcnqrqsbyrkrxlkrisxnyehetqpqsaeephozvqotlusaztpacecgytzkwhgumjcqxhgffdgqbnrwcfakmqingfqrytkvkwsvqbenxszmnqtigqpbidxgujrycceprtxfeyxiyopwnvnshlhhwgnrtbgafwyparpgughchdjyhcuyopnrrenjbirxjsuxeqdpcufutlwutlqzjsdgiweahslmnmjmrjctryvqzocwycarzcqvudienpocslqpnrrc...

output:

21
21

result:

ok 2 number(s): "21 21"

Test #71:

score: 0
Accepted
time: 908ms
memory: 18044kb

input:

2
dfkxktlhjhowekakwykibxsvodiuduwfonsaloaxriusxjxpaozqeinfswvbxjmeoypnaiuwaijahtsxdtkooecxpobfqfhuuuygwsxhvlgbsqbcqeruuqfeughuoecfvvhhtbalcszaludrqtusrlgztlyvgwezijyvqnlfhbeoggvxwbqbnkpyalxtehgkvzwkeyfjvdbvazbvixzvjlmklqrehrwzfgwiojjyrsktvrwrgfzryrtmaxnedtitejugrtbbziwnnbxbviytmpmlazulqrsrekpalbyfdt...

output:

17
29

result:

ok 2 number(s): "17 29"

Test #72:

score: 0
Accepted
time: 1319ms
memory: 19960kb

input:

2
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

33309
33300

result:

ok 2 number(s): "33309 33300"

Test #73:

score: 0
Accepted
time: 1317ms
memory: 18684kb

input:

2
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...

output:

33318
33304

result:

ok 2 number(s): "33318 33304"

Test #74:

score: 0
Accepted
time: 1466ms
memory: 17096kb

input:

2
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

8093
8061

result:

ok 2 number(s): "8093 8061"

Test #75:

score: 0
Accepted
time: 1199ms
memory: 17540kb

input:

2
ddddddddddddddddddddhhhhhhhhhhhhhhhhhhhhbbbbbbbbbbbbbbbbbbbbllllllllllllllllllllrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmjjjjjjjjjjjjjjjjjjjjppppppppppppppppppppzzzzzzzzzzzzzzzzzzzzttttttttttttttttttttyyyyyyyyyyyyyyyyyyyyiiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnkkkkkkkkkkkkkkkkkkkkwwwwwwwwwwwwwwwwww...

output:

20
20

result:

ok 2 number(s): "20 20"

Test #76:

score: 0
Accepted
time: 1171ms
memory: 17564kb

input:

2
yyyyyyyyyyyyyyyyyyymmmmmmmmmmmmmmmmmmmiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnkkkkkkkkkkkkkkkkkkkvvvvvvvvvvvvvvvvvvvhhhhhhhhhhhhhhhhhhhjjjjjjjjjjjjjjjjjjjllllllllllllllllllloooooooooooooooooooqqqqqqqqqqqqqqqqqqqgggggggggggggggggggdddddddddddddddddddfffffffffffffffffffbbbbbbbbbbbbbbbbbbbeeeeeeeeeeeee...

output:

19
19

result:

ok 2 number(s): "19 19"

Test #77:

score: 0
Accepted
time: 1122ms
memory: 17256kb

input:

2
uuuuuuuuuuuuuuuuuuvvvvvvvvvvvvvvvvvvbbbbbbbbbbbbbbbbbbyyyyyyyyyyyyyyyyyyeeeeeeeeeeeeeeeeeeppppppppppppppppppkkkkkkkkkkkkkkkkkkhhhhhhhhhhhhhhhhhhssssssssssssssssssmmmmmmmmmmmmmmmmmmwwwwwwwwwwwwwwwwwwddddddddddddddddddcccccccccccccccccciiiiiiiiiiiiiiiiiiaaaaaaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrjjjjjjjjjj...

output:

18
18

result:

ok 2 number(s): "18 18"

Test #78:

score: 0
Accepted
time: 1083ms
memory: 17512kb

input:

2
tttttttttttttttttwwwwwwwwwwwwwwwwwjjjjjjjjjjjjjjjjjqqqqqqqqqqqqqqqqqgggggggggggggggggpppppppppppppppppbbbbbbbbbbbbbbbbbssssssssssssssssslllllllllllllllllxxxxxxxxxxxxxxxxxzzzzzzzzzzzzzzzzzvvvvvvvvvvvvvvvvvdddddddddddddddddaaaaaaaaaaaaaaaaayyyyyyyyyyyyyyyyyuuuuuuuuuuuuuuuuucccccccccccccccccrrrrrrrrr...

output:

17
17

result:

ok 2 number(s): "17 17"

Test #79:

score: 0
Accepted
time: 1009ms
memory: 17348kb

input:

2
ssssssssssssssssggggggggggggggggzzzzzzzzzzzzzzzzttttttttttttttttddddddddddddddddqqqqqqqqqqqqqqqqwwwwwwwwwwwwwwwwiiiiiiiiiiiiiiiiaaaaaaaaaaaaaaaacccccccccccccccchhhhhhhhhhhhhhhhjjjjjjjjjjjjjjjjyyyyyyyyyyyyyyyyxxxxxxxxxxxxxxxxrrrrrrrrrrrrrrrruuuuuuuuuuuuuuuuppppppppppppppppffffffffffffffffbbbbbbbbbb...

output:

16
16

result:

ok 2 number(s): "16 16"

Test #80:

score: 0
Accepted
time: 962ms
memory: 17364kb

input:

2
bbbbbbbbbbbbbbbrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwlllllllllllllllooooooooooooooodddddddddddddddmmmmmmmmmmmmmmmiiiiiiiiiiiiiiikkkkkkkkkkkkkkkyyyyyyyyyyyyyyyzzzzzzzzzzzzzzznnnnnnnnnnnnnnnjjjjjjjjjjjjjjjfffffffffffffffpppppppppppppppgggggggggggggggeeeeeeeeeeeeeeecccccccccccccccxxxxxxxxxxxxxxxttttttttttttt...

output:

15
15

result:

ok 2 number(s): "15 15"

Test #81:

score: 0
Accepted
time: 908ms
memory: 17436kb

input:

2
ddddddddddddddvvvvvvvvvvvvvvssssssssssssssmmmmmmmmmmmmmmooooooooooooooppppppppppppppffffffffffffffiiiiiiiiiiiiiiqqqqqqqqqqqqqqzzzzzzzzzzzzzzxxxxxxxxxxxxxxjjjjjjjjjjjjjjcccccccccccccckkkkkkkkkkkkkkbbbbbbbbbbbbbbnnnnnnnnnnnnnnrrrrrrrrrrrrrrwwwwwwwwwwwwwwllllllllllllllhhhhhhhhhhhhhhttttttttttttttgggg...

output:

14
14

result:

ok 2 number(s): "14 14"

Test #82:

score: 0
Accepted
time: 1048ms
memory: 17412kb

input:

2
bcdbefbdcbghbcdbfebdcbijbcdbefbdcbhgbcdbfebdcbklbcdbefbdcbghbcdbfebdcbjibcdbefbdcbhgbcdbfebdcbmnbcdbefbdcbghbcdbfebdcbijbcdbefbdcbhgbcdbfebdcblkbcdbefbdcbghbcdbfebdcbjibcdbefbdcbhgbcdbfebdcbopbcdbefbdcbghbcdbfebdcbijbcdbefbdcbhgbcdbfebdcbklbcdbefbdcbghbcdbfebdcbjibcdbefbdcbhgbcdbfebdcbnmbcdbefbdcb...

output:

15
15

result:

ok 2 number(s): "15 15"

Test #83:

score: 0
Accepted
time: 1047ms
memory: 17392kb

input:

2
bcdbefbdcbghbcdbfebdcbijbcdbefbdcbhgbcdbfebdcbklbcdbefbdcbghbcdbfebdcbjibcdbefbdcbhgbcdbfebdcbmnbcdbefbdcbghbcdbfebdcbijbcdbefbdcbhgbcdbfebdcblkbcdbefbdcbghbcdbfebdcbjibcdbefbdcbhgbcdbfebdcbopbcdbefbdcbghbcdbfebdcbijbcdbefbdcbhgbcdbfebdcbklbcdbefbdcbghbcdbfebdcbjibcdbefbdcbhgbcdbfebdcbnmbcdbefbdcb...

output:

15
15

result:

ok 2 number(s): "15 15"

Test #84:

score: 0
Accepted
time: 1458ms
memory: 23548kb

input:

2
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

19101
19348

result:

ok 2 number(s): "19101 19348"

Test #85:

score: 0
Accepted
time: 1461ms
memory: 17768kb

input:

2
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

19367
19187

result:

ok 2 number(s): "19367 19187"

Test #86:

score: 0
Accepted
time: 189ms
memory: 17448kb

input:

2
abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabca...

output:

2
2

result:

ok 2 number(s): "2 2"

Test #87:

score: 0
Accepted
time: 181ms
memory: 24388kb

input:

2
abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabca...

output:

2
2

result:

ok 2 number(s): "2 2"

Extra Test:

score: 0
Extra Test Passed