#include <bits/stdc++.h>
using namespace std;
long k1, k2, n, m, j, k, i, r, p, a[10000000], l, vis[100], g;
pair<long, long> x[10000000];
string ch, st, s[100], t[100];
int main() {
  cin >> ch;
  p = ch.size() - 1;
  cin >> n;
  for (k = 1; k <= n; k++) cin >> t[k];
  for (k = 1; k < n; k++) {
    if (vis[k] == 1) continue;
    for (g = k + 1; g <= n; g++) {
      l = t[k].size();
      m = t[g].size();
      if (l == m) {
        if (t[k] == t[g]) {
          vis[k] = 1;
          break;
        };
        continue;
      };
      if (l > m) {
        st = t[g] + '$' + t[k];
        k1 = g;
        k2 = k;
        l = m;
      } else {
        st = t[k] + '$' + t[g];
        k1 = k;
        k2 = g;
      };
      a[0] = 0;
      for (i = 1; i < st.length(); i++) {
        j = a[i - 1];
        while (j > 0 && st[i] != st[j]) j = a[j - 1];
        if (st[i] == st[j]) j++;
        a[i] = j;
        if (a[i] == l) {
          vis[k2] = 1;
          break;
        };
      };
      if (vis[k] == 1) break;
    };
  };
  r = 0;
  for (k = 1; k <= n; k++) {
    if (vis[k] == 0) {
      r++;
      s[r] = t[k];
    }
  };
  n = r;
  r = 0;
  for (k = 1; k <= n; k++) {
    a[0] = 0;
    st = s[k] + '$' + ch;
    m = s[k].size();
    for (i = 1; i < st.length(); i++) {
      j = a[i - 1];
      while (j > 0 && st[i] != st[j]) j = a[j - 1];
      if (st[i] == st[j]) j++;
      a[i] = j;
      if (a[i] == m) {
        r++;
        x[r].second = i - m - 1;
        x[r].first = i - 2 * m;
      };
    };
  };
  sort(x + 1, x + r + 1);
  for (k = 1; k < r; k++)
    if (x[k + 1].first <= x[k].second && x[k].second <= x[k + 1].second) {
      x[k].first = x[k + 1].first;
      x[k + 1].second = x[k].second;
    };
  j = 0;
  i = x[1].second;
  for (k = 1; k < r; k++)
    if (x[k + 1].second - x[k].first - 1 > i) {
      i = x[k + 1].second - x[k].first - 1;
      j = x[k].first + 1;
    };
  if (p - x[r].first > i) {
    i = p - x[r].first;
    j = x[r].first + 1;
  };
  if (r != 0)
    cout << i << " " << j;
  else
    cout << ch.length() << " " << 0;
  return 0;
}
