#include <bits/stdc++.h>
using namespace std;
int n, m;
char second[100010], g[13][13];
int a[100010];
bool thr(int p, int k) {
  for (int i = 0; i < strlen(g[k]); i++)
    if (second[p + i] != g[k][i]) return false;
  return true;
}
int bestlen(int p) {
  int q = p + a[p] - 1;
  for (int i = p + 1; i < q; i++)
    if (a[i] != -1) {
      int qq = i + a[i] - 1;
      q = min(q, qq);
    }
  return q - p;
}
int main() {
  scanf("%s", second);
  n = strlen(second);
  m = ({
    int x;
    scanf("%d", &x);
    x;
  });
  for (int _n(m), i(0); i < _n; i++) scanf(" %s", g[i]);
  memset(a, -1, sizeof a);
  for (int _n(n), i(0); i < _n; i++) {
    int mn = 100010;
    for (int _n(m), j(0); j < _n; j++)
      if (thr(i, j)) mn = min(mn, (int)strlen(g[j]));
    if (mn < 100010) a[i] = mn;
  }
  int len = 0, pos = 0;
  for (int _n(n), i(0); i < _n; i++) {
    if (a[i] > 0) {
      int clen = bestlen(i);
      if (clen > len) len = clen, pos = i;
    } else {
      int j = i + 1;
      while (j < n && a[j] == -1) j++;
      int clen = j - i;
      if (j < n) clen += bestlen(j);
      if (clen > len) len = clen, pos = i;
      i = j;
    }
  }
  printf("%d %d\n", len, pos);
  return 0;
}
