#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
const long double pi = acos(-1);
bool debug = false;
long long int mod = 1e9 + 7;
const long long int mxm = 1e5 + 9;
mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x = x % mod;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
long long int inverse(long long int n) { return power(n, mod - 2); }
long long int kk[10] = {89,
                        101,
                        189,
                        94,
                        621,
                        (long long int)rng() % 1000 + 1051,
                        (long long int)rng() % 2000 + 2761,
                        (long long int)rng() % 4000 + 4441,
                        (long long int)rng() % 8000 + 8111,
                        (long long int)rng() % 16000 + 18883};
long long int primes[10] = {533000401,  735632791, 776531419, 797003413,
                            817504243,  920419813, 961748941, 982451653,
                            1000000007, 1000000009};
long long int dp1[mxm];
long long int dp2[mxm];
long long int base1;
long long int base2;
long long int m1;
long long int m2;
long long int inv1[mxm];
long long int inv2[mxm];
void assign_constants() {
  base1 = kk[rng() % 10];
  long long int y = rng() % 10;
  base2 = kk[y];
  if (base1 == base2) {
    y++;
    base2 = kk[y % 10];
  }
  m1 = primes[rng() % 10];
  y = rng() % 10;
  m2 = primes[y];
  if (m1 == m2) {
    y++;
    m2 = primes[y % 10];
  }
}
string s;
void precompute() {
  long long int tmp, i, x, x2, tmp2;
  tmp = 1;
  inv1[0] = 1;
  mod = m1;
  x = inverse(base1);
  dp1[0] = s[0] - '0' + 1;
  tmp2 = 1;
  inv2[0] = 1;
  mod = m2;
  x2 = inverse(base2);
  dp2[0] = s[0] - '0' + 1;
  for (i = 1; i <= s.size() - 1; i++) {
    tmp = (tmp * base1) % m1;
    inv1[i] = (inv1[i - 1] * x) % m1;
    dp1[i] = (dp1[i - 1] + (s[i] - '0' + 1) * tmp) % m1;
    tmp2 = (tmp2 * base2) % m2;
    inv2[i] = (inv2[i - 1] * x2) % m2;
    dp2[i] = (dp2[i - 1] + (s[i] - '0' + 1) * tmp2) % m2;
  }
}
long long int query1(long long int l, long long int r) {
  long long int ans1 = dp1[r];
  if (l) {
    ans1 -= dp1[l - 1];
  }
  ans1 = (ans1 + m1 + m1) % m1;
  ans1 *= inv1[l];
  ans1 %= m1;
  return ans1;
}
long long int query2(long long int l, long long int r) {
  long long int ans2 = dp2[r];
  if (l) {
    ans2 -= dp2[l - 1];
  }
  ans2 = (ans2 + m2 + m2) % m2;
  ans2 *= inv2[l];
  ans2 %= m2;
  return ans2;
}
long long int hashing_is_cool(string const& str, long long int b,
                              long long int m) {
  long long int pow_p = 1, p = b, ans = 0, i;
  for (i = 0; i < str.size(); i++) {
    ans += ((str[i] - '0' + 1) * pow_p) % m;
    ans %= m;
    pow_p *= p;
    pow_p %= m;
  }
  return ans;
}
struct node {
  long long int h1, h2, sz;
};
bool comparator(node a, node b) { return a.sz < b.sz; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t = 1, n, i, j, k, len, x, y, z, c, f, flag, p, q, mx, mn, l, r,
                sum, ans, tmp, it, pos, avg, m, cnt;
  char ch;
  vector<long long int> v;
  vector<pair<long long int, long long int>> vec;
  unordered_map<long long int, long long int> mappu;
  pair<long long int, long long int> pr;
  while (t--) {
    f = 0;
    sum = 0;
    flag = 0;
    ans = 0;
    cnt = 0;
    v.clear();
    mappu.clear();
    vec.clear();
    assign_constants();
    cin >> s;
    precompute();
    cin >> n;
    node a[n];
    for (i = 0; i < n; i++) {
      string str;
      cin >> str;
      l = hashing_is_cool(str, base1, m1);
      r = hashing_is_cool(str, base2, m2);
      a[i].h1 = l;
      a[i].h2 = r;
      a[i].sz = str.size();
    }
    sort(a, a + n, comparator);
    l = 0;
    r = 0;
    for (r = 0; r < s.size(); r++) {
      len = r - l + 1;
      while (l <= r) {
        flag = 0;
        for (i = 0; i < n; i++) {
          if (a[i].sz > len) break;
          long long int right = r;
          long long int left = r - a[i].sz;
          left++;
          if (query1(left, right) == a[i].h1) {
            flag = 1;
            l = left + 1;
            goto lbl;
          }
        }
        if (flag == 0) break;
        l++;
      }
    lbl:
      if (l <= r) {
        bool ok = true;
        if (ok) vec.push_back({l, r});
      }
    }
    pr = {0, 0};
    for (auto it : vec) {
      pr = max(pr, {it.second - it.first + 1, it.first});
    }
    cout << pr.first << " " << pr.second;
  }
  return 0;
}
