#include <bits/stdc++.h>
char a[100043];
int mark[100043][12];
int mark2[100045][12];
int ret[12][100043];
int retcnt[12];
int len;
int n;
char b[12][12];
int max;
int maxp;
void process() {
  int i = 0;
  int j, k, l, k2;
  int rej;
  int ch[12];
  while (i < len) {
    l = 0;
    for (j = 0; j < n; j++) ch[j] = 0;
    for (; i < len; i++) {
      k = 0;
      rej = -1;
      for (j = 0; j < n; j++)
        if (mark[i][j] == 1 || mark[i][j] == -3) {
          ch[j] = 1;
        }
      for (j = 0; j < n; j++)
        if (ch[j] == 1)
          if (mark2[i][j] < 0) {
            ch[j] = -1;
          }
      for (j = 0; j < n; j++)
        if (ch[j] == -1) {
          if (rej < 0 || strlen(b[rej]) < strlen(b[j])) rej = j;
          k = 1;
        }
      if (k == 1) {
        break;
      }
      l++;
    }
    if (max < l) {
      max = l;
      maxp = i - l;
    }
    if (rej >= 0) {
      j = 0;
      k = retcnt[rej];
      while (j < k) {
        k2 = (j + k) / 2;
        if (i >= ret[rej][k2]) {
          j = k2 + 1;
        } else {
          k = k2;
        }
      }
      i = ret[rej][k - 1] + 1;
    }
  }
  printf("%d %d\n", max, maxp);
}
void input() {
  int i, j, k, l;
  int cnt = 0;
  for (j = 0; j < n; j++) {
    l = strlen(b[j]);
    for (i = 0; i < len; i++) {
      if (l == 1) {
        if (a[i] == b[j][0]) {
          mark[i][j] = -3;
          mark2[i][j] = -3;
          ret[j][retcnt[j]++] = i;
        }
      } else {
        cnt = 0;
        for (k = 0; k < l; k++) {
          if (a[i + k] == b[j][k]) cnt++;
        }
        if (cnt == l) {
          mark[i][j] = 1;
          mark2[i + l - 1][j] = -1;
          ret[j][retcnt[j]++] = i;
        }
      }
    }
  }
}
int main() {
  scanf("%s", a);
  len = strlen(a);
  scanf("%d", &n);
  int i;
  for (i = 0; i < n; i++) {
    scanf("%s", b[i]);
  }
  input();
  process();
  return 0;
}
