#include <bits/stdc++.h>
using namespace std;
string s;
int n, m, t, x, g;
int f[100005];
string b[15];
int l[15];
int main() {
  cin >> s;
  n = s.length();
  scanf("%d\n", &m);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    l[i] = b[i].length();
    scanf("\n");
  }
  f[0] = 0;
  for (int i = 0; i < n; i++) {
    x = f[i] + 1;
    t = 0;
    for (int j = 0; j < m; j++)
      if (l[j] <= x) {
        g = 1;
        for (int w = 0; w < l[j]; w++)
          if (b[j][w] != s[i - l[j] + 1 + w]) {
            g = 0;
            break;
          }
        t = g;
        if (t) break;
      }
    if (!t) {
      f[i + 1] = x;
      continue;
    }
    x = i + 1;
    t = 1000;
    for (int j = 0; j < m; j++)
      if (l[j] <= x) {
        g = 1;
        for (int w = 0; w < l[j]; w++)
          if (b[j][w] != s[i - l[j] + 1 + w]) {
            g = 0;
            break;
          }
        if (g) {
          if (l[j] < t) t = l[j];
        }
      }
    f[i + 1] = t - 1;
  }
  t = 0;
  x = -1;
  for (int i = 1; i <= n; i++)
    if (f[i] > t) {
      t = f[i];
      x = i - 1;
    }
  printf("%d %d\n", t, x - t + 1);
  return 0;
}
