#include <bits/stdc++.h>
using namespace std;
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, 1, -1};
const unsigned long long hs = 3797;
unsigned long long F[100005], H[100005], H2[15];
int H2_size[15];
unsigned long long seg(int x, int y) { return H[y] - F[y - x + 1] * H[x - 1]; }
int main() {
  F[0] = 1;
  for (int i = 1; i <= 100005; i++) F[i] = F[i - 1] * hs;
  string str, p;
  str = ".";
  cin >> p;
  str = str + p;
  H[0] = 0;
  for (int i = 1; i <= str.size() - 1; i++) {
    H[i] = H[i - 1] * hs + str[i];
  }
  int N;
  cin >> N;
  for (int k = 1; k <= N; k++) {
    string st, pp;
    st = ".";
    cin >> pp;
    st = st + pp;
    H2_size[k] = st.size() - 1;
    H2[k] = 0;
    for (int i = 1; i <= st.size() - 1; i++) {
      H2[k] = H2[k] * hs + st[i];
    }
  }
  int start = 0, cnt = 0, ans = 0, ans_pos = 0;
  for (int i = 1; i <= str.size() - 1; i++) {
    bool flag = false;
    int new_pos = 0;
    for (int k = 1; k <= N; k++) {
      if (i - H2_size[k] >= start) {
        if (seg(i - H2_size[k] + 1, i) == H2[k]) {
          flag = true;
          new_pos = max(new_pos, i - H2_size[k] + 1);
        }
      }
    }
    if (flag) {
      if (cnt > ans) {
        ans = cnt;
        ans_pos = start;
      }
      cnt = cnt - (new_pos - start) + 1;
      start = new_pos;
      continue;
    }
    cnt++;
  }
  if (cnt > ans) {
    ans = cnt;
    ans_pos = start;
  }
  cout << ans << ' ' << ans_pos;
}
