#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
char s[N];
char forbid[10][11];
int len[10];
int m;
bool check(int head, int tail) {
  for (int i = 0; i < m; ++i)
    if (len[i] <= tail - head + 1 &&
        strncmp(s + tail - len[i] + 1, forbid[i], len[i]) == 0)
      return false;
  return true;
}
int main() {
  int n;
  scanf("%s", s);
  n = strlen(s);
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%s", forbid[i]);
    len[i] = strlen(forbid[i]);
  }
  int best = -1, start = -1;
  int head = 0;
  for (int i = 0; i < n; ++i) {
    while (head <= i && !check(head, i)) ++head;
    if (best < i - head + 1) {
      best = i - head + 1;
      start = head;
    }
  }
  printf("%d %d\n", best, start);
  return 0;
}
