#include <bits/stdc++.h>
using namespace std;
char ss[100010];
string s;
string s1;
pair<int, int> b[2000000];
int m[100100];
unsigned long long h[100100];
unsigned long long p[100100];
int main() {
  scanf("%s", &ss);
  s = (string)ss;
  h[0] = 0;
  p[0] = 1;
  for (int i = (1); i < (100100); ++i) p[i] = p[i - 1] * 257;
  for (int i = (0); i < (s.size()); ++i)
    h[i + 1] = h[i] + (unsigned int)s[i] * p[i];
  int n;
  cin >> n;
  int sz = 0;
  for (int it = (0); it < (n); ++it) {
    cin >> s1;
    unsigned long long h1 = 0;
    for (int i = (0); i < (s1.size()); ++i) h1 += (unsigned int)s1[i] * p[i];
    int pp = (int)(s.size()) - (int)s1.size();
    for (int i = (0); i < (pp + 1); ++i) {
      if (h1 * p[i] == h[i + s1.size()] - h[i]) {
        b[sz] = make_pair(i, i + s1.size() - 1);
        sz++;
      }
    }
  }
  for (int i = (0); i < (s.size()); ++i) m[i] = (int)s.size();
  for (int i = (0); i < (sz); ++i)
    m[b[i].first] =
        ((m[b[i].first] < b[i].second) ? (m[b[i].first]) : (b[i].second));
  for (int i = (int)s.size() - 2; i >= 0; --i)
    m[i] = ((m[i] < m[i + 1]) ? (m[i]) : (m[i + 1]));
  int res = 0;
  int res1 = 0;
  for (int i = (0); i < (s.size()); ++i) {
    int len = m[i] - i;
    if (len > res) {
      res = len;
      res1 = i;
    }
  }
  printf("%d %d\n", res, res1);
  return 0;
}
