#include <bits/stdc++.h>
using namespace std;
template <class T>
int size(const T &a) {
  return int(a.size());
}
template <class T>
T sqr(const T &a) {
  return a * a;
}
const int max_n = 100010;
char a[max_n];
char s[10][20];
int p[10][20];
int len[10];
int u[10];
void init(char *s, int *p) {
  int u = 0;
  for (int i = 1; s[i]; i++) {
    while (u > 0 && s[u] != s[i]) u = p[u];
    if (s[i] == s[u]) u++;
    p[i + 1] = u;
  }
}
int main() {
  scanf("%s", a);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s[i]);
    init(s[i], p[i]);
    len[i] = int(strlen(s[i]));
  }
  int left = 0;
  int mlen = 0, mpos = 0;
  for (int i = 0; a[i]; i++) {
    bool bad = 0;
    for (int j = 0; j < n; j++) {
      while (u[j] > 0 && a[i] != s[j][u[j]]) u[j] = p[j][u[j]];
      if (a[i] == s[j][u[j]]) u[j]++;
      if (u[j] == len[j]) {
        bad = 1;
        left = max(i - len[j] + 2, left);
      }
    }
    if (bad) {
      for (int j = 0; j < n; j++) {
        while (u[j] > 0 && i - u[j] + 1 < left) u[j] = p[j][u[j]];
      }
    } else {
      if (i - left + 1 > mlen) {
        mlen = i - left + 1;
        mpos = left;
      }
    }
  }
  printf("%d %d", mlen, mpos);
  return 0;
}
