#include <bits/stdc++.h>
using namespace std;
string itos(int i) {
  stringstream s;
  s << i;
  return s.str();
}
string lltos(long long i) {
  stringstream s;
  s << i;
  return s.str();
}
long long stoll(string target) {
  stringstream s;
  s << target;
  long long w;
  s >> w;
  return w;
}
int stoi(string target) {
  stringstream s;
  s << target;
  int w;
  s >> w;
  return w;
}
int x = 0, y, z, pom, start, h, t, i, j, n, k = 0, m, br = 0, mom = 0, f, g;
int pamti = 0, odgovor = 0, pocetok, kraj, a[100001], preth;
vector<int> b[100001];
bool final = false, ok;
string s, c[100];
int main() {
  cin >> s;
  cin >> n;
  for (i = 1; i <= (int)(n); i++) cin >> c[i];
  a[0] = 0;
  a[1] = (int)s[0];
  for (i = 1; i <= (int)(s.size() - 1); i++) a[i + 1] = a[i] + (int)s[i];
  for (j = 1; j <= (int)(n); j++) {
    br = (int)c[j][0];
    for (k = 1; k <= (int)(c[j].size() - 1); k++) br += (int)c[j][k];
    for (i = 1; i <= (int)(s.size()); i++) {
      if (a[i + (int)c[j].size() - 1] - a[i - 1] == br) {
        ok = true;
        for (k = 0; k < (int)(c[j].size()); k++)
          if (i + k - 1 <= (int)s.size() - 1)
            if (c[j][k] != s[i + k - 1]) {
              ok = false;
              break;
            }
        if (!ok) continue;
        b[i + (int)c[j].size() - 1].push_back(i);
      }
    }
  }
  preth = 0;
  pamti = 0;
  odgovor = 0;
  for (i = 1; i <= (int)(s.size()); i++) {
    for (j = 0; j < (int)(b[i].size()); j++) preth = max(preth, b[i][j]);
    if (odgovor < i - preth) {
      odgovor = i - preth;
      pamti = preth + 1;
    }
  }
  if (odgovor == 0) pamti = 1;
  cout << odgovor << " " << pamti - 1 << endl;
  return 0;
}
