#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
int main() {
  int n, len, a[100010], f[100010], dai, max = 0, vitri = 0;
  char s[100010];
  char si[13][13];
  bool kt;
  scanf("%s", s);
  len = strlen(s);
  for (int i = 0; i < len; i++) f[i] = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%s", si[i]);
  for (int i = 0; i < len; i++) {
    dai = 100;
    for (int j = 1; j <= n; j++) {
      kt = true;
      for (int k = 0; k < strlen(si[j]); k++)
        if (si[j][k] != s[i + k]) {
          kt = false;
          break;
        }
      if (kt && strlen(si[j]) < dai) dai = strlen(si[j]);
    }
    a[i] = dai;
  }
  f[len] = 0;
  for (int i = len - 1; i >= 0; i--) {
    if (a[i] != 100)
      f[i] = min(f[i + 1] + 1, a[i] - 1);
    else
      f[i] = f[i + 1] + 1;
    if (f[i] > max) {
      max = f[i];
      vitri = i;
    }
  }
  printf("%d %d", max, vitri);
}
