#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
int *buildFail(char *p) {
  int m = strlen(p);
  int *fail = new int[m + 1];
  int j = fail[0] = -1;
  for (int i = 1; i <= m; ++i) {
    while (j >= 0 && p[j] != p[i - 1]) j = fail[j];
    fail[i] = ++j;
  }
  return fail;
}
vector<int> match(char *t, char *p, int *fail) {
  int n = strlen(t), m = strlen(p);
  int count = 0;
  vector<int> res;
  for (int i = 0, k = 0; i < n; ++i) {
    while (k >= 0 && p[k] != t[i]) k = fail[k];
    if (++k >= m) {
      res.push_back(i - m + 1);
      ++count;
      k = fail[k];
    }
  }
  return res;
}
int main() {
  char s[100001];
  cin >> s;
  int n;
  cin >> n;
  vector<int> v[n];
  char b[n][11];
  vector<int> hoge(strlen(s), INF);
  for (int i = 0; i < (int)n; ++i) {
    cin >> b[i];
    v[i] = match(s, b[i], buildFail(b[i]));
    for (__typeof((v[i]).begin()) it = (v[i]).begin(); it != (v[i]).end();
         ++it) {
      hoge[*it] = min(hoge[*it], (int)strlen(b[i]));
    }
  }
  int k = strlen(s) - 1, l = strlen(s);
  int len = 0, po = 0;
  while (k >= 0) {
    l = min(l, k + hoge[k] - 1);
    if (len < l - k) {
      len = l - k;
      po = k;
    }
    k--;
  }
  cout << len << " " << po << endl;
}
