#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, i, l, max, s, f[100005];
  char a[100005], b[15];
  while (scanf("%s%d", a, &t) != EOF) {
    n = strlen(a);
    for (i = 0; i < n; i++) f[i] = n - i;
    while (t--) {
      scanf("%s", b);
      l = strlen(b);
      for (i = 0; i < n; i++)
        if (f[i] > l - 1 && memcmp(b, a + i, l * sizeof(char)) == 0)
          f[i] = l - 1;
    }
    f[n] = 0;
    for (i = n - 1; i >= 0; i--)
      if (f[i] > f[i + 1] + 1) f[i] = f[i + 1] + 1;
    max = s = 0;
    for (i = 0; i < n; i++)
      if (max < f[i]) max = f[i], s = i;
    printf("%d %d\n", max, s);
  }
  return 0;
}
