#include <bits/stdc++.h>
using namespace std;
const long long oo = 2e18 + 7;
const long long maxn = 1e5 + 7;
const int mod = 1e9 + 7;
int n, m, t;
string s, org[11];
long long base = 2309;
long long f[maxn], Pow[maxn];
long long dp[maxn];
vector<pair<long long, long long> > u, v;
vector<long long> ttt;
void prepare() {
  Pow[0] = 1;
  for (int i = 1; i < maxn; ++i) Pow[i] = (Pow[i - 1] * base) % mod;
}
long long Hash(string g) {
  long long len = g.size(), tmp = 0;
  for (int i = 1; i < len; ++i) tmp = (tmp * base + g[i]) % mod;
  return tmp;
}
void Hash_Array(long long h[], string g) {
  for (int i = 1; i <= n; ++i) h[i] = (h[i - 1] * base + g[i]) % mod;
}
long long get_Hash(int i, int j) {
  if (i == 0) return f[j];
  long long tmp = (f[j] - f[i - 1] * Pow[j - i + 1]) % mod;
  if (tmp < 0) tmp += mod;
  return tmp;
}
void process() {
  prepare();
  Hash_Array(f, s);
  v.assign(t + 1, pair<long long, long long>());
  for (int i = 1; i <= t; ++i) v[i] = {Hash(org[i]), i};
  for (int i = 1; i <= n; ++i) {
    long long Max = -1, Min = oo;
    for (int j = 1; j <= t; ++j) {
      long long k = i - (org[j].size() - 1) + 1;
      if (k < 1) continue;
      long long x = get_Hash(k, i);
      if (x == v[j].first) {
        Min = min(Min, k);
        Max = max(Max, k);
      }
    }
    if (Min != oo) u.push_back({Min, i});
    if (Min != Max && Max != -1) u.push_back({Max, i});
  }
  m = u.size();
  sort(u.begin(), u.end());
  if (u.size() == 0) {
    cout << n << ' ' << 0;
    return;
  } else {
    u.push_back({u[m - 1].first, n + 1});
    u.push_back({0, u[0].second - 1});
  }
  sort(u.begin(), u.end());
  m = u.size();
  ttt.assign(m + 1, n + 1);
  vector<long long> tmp(m + 1, n);
  for (int i = 0; i < m; ++i) tmp[i] = u[i].first;
  for (int i = m - 1; i >= 0; --i) ttt[i] = min(ttt[i + 1], u[i].second);
  long long res = 0, vt = 1;
  for (int i = 0; i < m; ++i) {
    long long x = u[i].first + 1;
    long long y = lower_bound(tmp.begin(), tmp.end(), x) - tmp.begin();
    if (y <= m && ttt[y] - x > res) {
      res = ttt[y] - x;
      vt = x;
    }
  }
  cout << res << ' ' << vt - 1;
}
void enter() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  n = s.size();
  s = "/" + s;
  cin >> t;
  for (int i = 1; i <= t; ++i) {
    cin >> org[i];
    org[i] = "/" + org[i];
  }
}
signed main() {
  enter();
  process();
}
