#include <bits/stdc++.h>
using namespace std;
char str[100006];
char bad[16][16];
int lenb[16], allowed[100006];
int match(char *s1, char *s2) {
  int ret = 0;
  while (*s1 && *s1 == *s2) {
    ++ret;
    ++s1, ++s2;
  }
  return ret;
}
int main() {
  int b, B, N, temp, i, j;
  int ans, idx, last;
  while (scanf("%s", str) != EOF) {
    N = strlen(str);
    scanf("%d", &B);
    for (b = 0; b < B; ++b) {
      scanf("%s", bad[b]);
      lenb[b] = strlen(bad[b]);
    }
    for (i = 0; i < N; ++i) {
      allowed[i] = N - 1;
      for (b = 0; b < B; ++b) {
        if (match(&str[i], bad[b]) == lenb[b]) {
          temp = i + lenb[b] - 2;
          if (temp < allowed[i]) allowed[i] = temp;
        }
      }
    }
    ans = allowed[N - 1] - (N - 1) + 1, idx = N - 1, last = allowed[N - 1];
    for (i = N - 2; i >= 0; --i) {
      if (allowed[i] < last) last = allowed[i];
      if (allowed[i] < i) {
        continue;
      }
      temp = last - i + 1;
      if (temp > ans) {
        ans = temp;
        idx = i;
      }
    }
    printf("%d %d\n", ans, idx);
  }
  return 0;
}
