#include <bits/stdc++.h>
using namespace std;
char buf[100010];
string s;
string ng[20];
int bad[100010];
int main(void) {
  int N, K, i, j, k, ansi = 0, ansj = 0;
  scanf("%s", buf);
  s = buf;
  scanf("%d", &K);
  for ((i) = 0; (i) < (int)(K); (i)++) {
    scanf("%s", buf);
    ng[i] = buf;
  }
  N = s.length();
  for ((i) = 0; (i) < (int)(N + 1); (i)++) bad[i] = -(1 << 29);
  for ((i) = 0; (i) < (int)(K); (i)++) {
    int len = ng[i].length();
    for ((j) = 0; (j) < (int)(N - len + 1); (j)++) {
      for ((k) = 0; (k) < (int)(len); (k)++)
        if (s[j + k] != ng[i][k]) break;
      if (k == len) bad[j + len] = max(bad[j + len], j);
    }
  }
  j = 0;
  for ((i) = 0; (i) < (int)(N + 1); (i)++) {
    if (j < i) j = i;
    while (j < N && bad[j + 1] < i) j++;
    if (j - i > ansj - ansi) {
      ansi = i;
      ansj = j;
    }
  }
  printf("%d %d\n", ansj - ansi, ansi);
  return 0;
}
