#include <bits/stdc++.h>
using namespace std;
vector<int> av[11];
string arr[11];
int first(int i, int uu) {
  if (av[i].size() == 0) return -1;
  int u = av[i].size() - 1;
  int l = 1;
  if (av[i][0] >= uu)
    return av[i][0];
  else if (av[i][av[i].size() - 1] < uu)
    return -1;
  else {
    while (l <= u) {
      int mid = (l + u) / 2;
      if (av[i][mid] >= uu && av[i][mid - 1] < uu) {
        return av[i][mid];
      } else if (av[i][mid] < uu)
        l = mid + 1;
      else
        u = mid - 1;
    }
  }
}
int lc(int i, int v, int u) {
  int gh = v - arr[i].length() + 1;
  if (av[i].size() == 0)
    return 0;
  else if ((first(i, u) <= gh) && (first(i, u) != -1))
    return 1;
  else
    return 0;
}
bool kg(int v, int u, int k) {
  for (int i = 0; i < k; i++) {
    int qw = lc(i, v, u);
    if (qw >= 1) return false;
  }
  return true;
}
int fn(int j, int n, int k) {
  int l = j;
  int u = n - 1;
  if (kg(u, j, k)) return u;
  if (!kg(l, j, k)) return -7;
  while (l <= u) {
    int mid = (l + u) / 2;
    if (kg(mid, j, k) && !kg(mid + 1, j, k))
      return mid;
    else if (!kg(mid, j, k))
      u = mid - 1;
    else
      l = mid + 1;
  }
}
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    int rt = s.length() - arr[i].length();
    for (int j = 0; j <= rt; j++) {
      if (s.substr(j, arr[i].length()) == arr[i]) av[i].push_back(j);
    }
  }
  int maxi = 0;
  int pos = 0;
  for (int j = 0; j < s.length(); j++) {
    if (fn(j, s.length(), n) - j + 1 > maxi) {
      maxi = fn(j, s.length(), n) - j + 1;
      pos = j;
    }
  }
  cout << maxi << " " << pos << endl;
  return 0;
}
