#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void checkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
  if (a < b) a = b;
}
const int oo = 1 << 30;
const double eps = 1e-7;
const int N = 102400;
const int M = 1;
const long long P = 10000000097ll;
char s[N];
bool f[N];
int fn[N];
int sn, dn;
void doit() {
  int i, j, k;
  int n;
  char st[16];
  int stn;
  scanf("%s", st);
  stn = strlen(st);
  n = sn - stn + 1;
  for ((i) = 0; i < (n); (i)++) {
    for ((j) = 0; j < (stn); (j)++)
      if (s[i + j] != st[j]) break;
    if (stn == j) {
      f[i + stn - 1] = 1;
      checkmin(fn[i + stn - 1], stn);
    }
  }
}
void def() {
  int st, mx;
  st = mx = 0;
  int ts, tp, ed;
  int i, j, k;
  f[sn] = 1;
  fn[sn] = 1;
  for ((ed) = 0; ed < (sn); (ed)++)
    if (f[ed]) break;
  for (ts = 0; ts < sn; ts++) {
    while (!f[ed] || ed - fn[ed] + 1 < ts) ed++;
    if (ed - ts > mx) {
      mx = ed - ts;
      st = ts;
    }
  }
  printf("%d %d\n", mx, st);
}
int main() {
  int T, _ = 0;
  dn = 0;
  scanf("%s", s);
  sn = strlen(s);
  memset(f, false, (sizeof(char)) * (sn + 10));
  (memset((fn), 0x7f, sizeof(fn)));
  scanf("%d", &T);
  while (T--) doit();
  def();
  return 0;
}
