#include <bits/stdc++.h>
char s[100001], s1[11][11];
int x[110001];
int n, c = 0, l1 = 0, p1 = 0, m = 0, l2 = 0, p2 = 0;
void f(int a);
using namespace std;
int main() {
  int i, j, k = 0, len = 0, pos = 0;
  scanf("%s", s);
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%s", s1[i]);
  len = strlen(s);
  for (i = 0; i < len; i++) f(i);
  if (m == 0) {
    printf("%d 0", len);
    return 0;
  }
  k = strlen(s) - 1;
  if ((int)fabs(c - k) > l1) {
    l1 = (int)fabs(c - k);
    p1 = c + 1;
  }
  printf("%d %d", l1, p1);
  getchar();
  getchar();
  return 0;
}
void f(int a) {
  int i, j, k = 0, b = 0, l = 0, s2 = 0;
  for (i = 1; i <= n; i++) {
    k = 0;
    b = 0;
    s2 = strlen(s1[i]) - 1;
    for (j = s2; j >= 0; j--) {
      if (s[a - k] == s1[i][j] && a >= k)
        k++;
      else {
        b = 1;
        break;
      }
    }
    if (m == 0 && !b) {
      l1 = (int)fabs(0 - a);
      c = a - (k - 1);
      m++;
      continue;
    }
    if (!b) {
      k--;
      if (l1 < ((int)fabs(c - a) - 1)) {
        l1 = ((int)fabs(c - a) - 1);
        p1 = c + 1;
      }
      if (c < a - k) c = a - k;
    }
  }
}
