#include <bits/stdc++.h>
using namespace std;
char s[203600];
char a[20][20];
bool b[203600][20];
int l[20];
int n;
int main() {
  memset(b, 0, sizeof(b));
  scanf("%s%d", s, &n);
  for (int i = (0); i < (int)(n); i++) scanf("%s", a[i]);
  int len = strlen(s);
  int ans = 0, pos = 0, st = 0;
  for (int j = (0); j < (int)(len); j++) {
    for (int i = (0); i < (int)(n); i++) {
      int m = strlen(a[i]);
      if (j >= m - 1 && !strncmp(a[i], s + j - m + 1, m)) {
        st = max(st, j - m + 2);
      }
    }
    if (j - st + 1 > ans) {
      ans = j - st + 1;
      pos = st;
    }
  }
  printf("%d %d\n", ans, pos);
}
