#include <bits/stdc++.h>
using namespace std;
int L, f[10], bLen[10];
char s[100001], b[11];
vector<int> pos[10];
int main() {
  scanf("%s", s);
  L = strlen(s);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", b);
    int k = 0, L2 = strlen(b);
    bLen[i] = L2;
    f[0] = 0;
    for (int j = 1; j < L2; ++j) {
      while (k > 0 && b[k] != b[j]) k = f[k - 1];
      if (b[k] == b[j]) ++k;
      f[j] = k;
    }
    k = 0;
    for (int j = 0; j < L; ++j) {
      while (k > 0 && b[k] != s[j]) k = f[k - 1];
      if (b[k] == s[j]) ++k;
      if (k == L2) {
        pos[i].push_back(j - L2 + 1);
        k = f[k - 1];
      }
    }
  }
  int ans_ind = 0, ans_len = 0;
  for (int i = 0; i < L; ++i) {
    int len = L - i;
    for (int j = 0; j < n; ++j) {
      int sz = pos[j].size();
      if (sz > 0 && pos[j][sz - 1] >= i) {
        int lo = 0, hi = sz - 1, mi;
        while (lo < hi) {
          mi = (lo + hi) >> 1;
          if (pos[j][mi] >= i)
            hi = mi;
          else
            lo = mi + 1;
        }
        len = min(len, pos[j][lo] - i + bLen[j] - 1);
      }
    }
    if (len > ans_len) {
      ans_len = len;
      ans_ind = i;
    }
  }
  printf("%d %d\n", ans_len, ans_ind);
  return 0;
}
