#include <bits/stdc++.h>
using namespace std;
long long int powmod(long long int a, int b, int n) {
  long long int rm = 1;
  while (b) {
    if (b % 2) {
      rm = (rm * a) % n;
    }
    a = (a * a) % n;
    b /= 2;
  }
  return rm;
}
string s, b[20];
int found[int(1e5 + 10)] = {0}, m;
int main() {
  cin >> s;
  cin >> m;
  for (int i = int(1); i <= (int)m; i++) cin >> b[i];
  int n = s.size();
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (i >= b[j].size()) {
        if (i - (b[j].size()) + 1 > found[i]) {
          int tmp = i - (b[j].size()) + 1;
          for (int k = i - (b[j].size()) + 1; k <= i; k++) {
            if (s[k - 1] != b[j][k - (i - (b[j].size()) + 1)]) {
              tmp = found[i];
              break;
            }
          }
          found[i] = tmp;
        }
      }
    }
  }
  int p1 = 1, p2 = 1, stp = -1, ans = 0;
  while (p1 <= n) {
    while (p2 <= n) {
      if (found[p2] && found[p2] >= p1) break;
      if (p2 - p1 + 1 > ans) {
        ans = p2 - p1 + 1;
        stp = p1;
      }
      p2++;
    }
    if (p2 > n) break;
    p1++;
    p2 = max(p2, p1);
  }
  if (!ans) stp = 1;
  cout << ans << " " << stp - 1 << endl;
  return 0;
}
