#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
char s[100009], p[100009];
int ok(int x, int y) {
  int c = 0;
  for (int i = x; i <= y; i++) {
    if (s[i] != p[c]) return 0;
    c++;
  }
  return 1;
}
vector<int> adj[100009];
int main() {
  scanf("%s", s);
  int n = strlen(s), q;
  scanf("%d", &q);
  while (q--) {
    scanf("%s", p);
    int m = strlen(p);
    for (int i = 0; i <= n - m; i++)
      if (ok(i, i + m - 1)) adj[i + m - 1].push_back(i);
  }
  int st = 0, en = 0, pos = 0, mx = 0;
  while (st < n) {
    while (st <= en and en < n) {
      int d = 0;
      for (int i = 0; i < adj[en].size(); i++)
        if (adj[en][i] >= st) {
          d = 1;
          break;
        }
      if (d)
        st++;
      else {
        if (umax(mx, en - st + 1)) pos = st;
        en++;
      }
    }
    if (st > en)
      en = st;
    else
      break;
  }
  printf("%d %d\n", mx, pos);
  return 0;
}
