#include <bits/stdc++.h>
using namespace std;
using namespace std;
int t[111111];
int rights[111111];
int main() {
  string s;
  cin >> s;
  int n;
  scanf("%d", &(n));
  int len = s.length();
  for (int i = 0; i < len; i++) rights[i] = len;
  for (int i = 1; i <= n; i++) {
    string str;
    cin >> str;
    int strl = str.length();
    for (int i = 0; i < len; i++) {
      int j = 0;
      int tmpi = i;
      while (i < len && s[i] == str[j]) {
        i++;
        j++;
        if (j == strl) {
          rights[tmpi] = min(rights[tmpi], i - 1);
        }
      }
      i = tmpi;
    }
  }
  int maxn = 0;
  int ansPos = 0;
  int rt = len;
  for (int i = len - 1; i >= 0; i--) {
    rt = min(rt, rights[i]);
    if (rt - i > maxn) {
      maxn = rt - i;
      ansPos = i;
    }
  }
  cout << maxn << " " << ansPos << endl;
  return 0;
}
