#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5, inf = 1e18;
long long n;
long long bestUpto[N];
struct segtree {
  long long* tree;
  void build(long long u, long long tl, long long tr) {
    if (tl == tr)
      tree[u] = bestUpto[tl];
    else {
      long long mid = (tl + tr) >> 1;
      build(2 * u, tl, mid);
      build(2 * u + 1, mid + 1, tr);
      tree[u] = min(tree[2 * u], tree[2 * u + 1]);
    }
  }
  void init(long long nn) {
    tree = new long long[nn * 4];
    build(1, 1, nn);
  }
  long long getMin(long long tl, long long tr, long long u, long long ql,
                   long long qr) {
    if (tl > tr || ql > qr) return inf;
    if (tl == ql && tr == qr) return tree[u];
    long long mid = (tl + tr) >> 1;
    return min(getMin(tl, mid, 2 * u, ql, min(mid, qr)),
               getMin(mid + 1, tr, 2 * u + 1, max(ql, mid + 1), qr));
  }
} T;
long long getMin(long long L, long long R) {
  assert(L <= R);
  return T.getMin(1, n, 1, L, R);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  s = "@" + s;
  long long m;
  cin >> m;
  vector<string> strs(m);
  for (auto& str : strs) cin >> str;
  n = s.size() - 1;
  for (long long i = 1; i <= n; i++) {
    bestUpto[i] = inf;
    for (long long j = 0; j < m; j++) {
      long long len = (long long)(strs[j].size());
      if (i + len - 1 > n) continue;
      bool keep = true;
      for (long long k = 0; k < len; k++) keep &= s[i + k] == strs[j][k];
      if (keep) bestUpto[i] = min(bestUpto[i], i + len - 1);
    }
  }
  T.init(n);
  long long bestLen = 0, start = 0;
  for (long long i = (1); i <= (n); i++) {
    long long L = i;
    long long R = -1;
    long long lo = i, hi = n;
    while (lo <= hi) {
      long long mid = (lo + hi) >> 1;
      long long worst = getMin(L, mid);
      assert(worst >= L);
      if (worst > mid)
        R = mid, lo = mid + 1;
      else
        hi = mid - 1;
    }
    if (~R)
      if (bestLen < R - L + 1) bestLen = R - L + 1, start = L - 1;
  }
  cout << bestLen << " " << start << "\n";
}
