#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > match[11];
bool check(int esq, int dre) {
  if (esq > dre) return true;
  for (int mida = 1; mida <= 10; ++mida) {
    int e = 0, d = match[mida].size() - 1, r = -1;
    while (e <= d) {
      int m = (e + d) / 2;
      if (match[mida][m].first >= esq) {
        r = m;
        d = m - 1;
      } else
        e = m + 1;
    }
    if (r != -1 and esq <= match[mida][r].first and
        match[mida][r].second <= dre)
      return false;
  }
  return true;
}
int main() {
  string s;
  cin >> s;
  int len = s.size();
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string t;
    cin >> t;
    int m = t.size();
    for (int j = 0; j + m <= len; ++j) {
      bool ok = true;
      for (int k = 0; k < m; ++k)
        if (s[j + k] != t[k]) ok = false;
      if (ok) match[m].push_back(pair<int, int>(j, j + m - 1));
    }
  }
  for (int i = 1; i <= 10; ++i) sort(match[i].begin(), match[i].end());
  int maxi = 0, best = 0;
  int e = 0;
  for (int d = 0; d < len; ++d) {
    while (not check(e, d)) ++e;
    int sz = d - e + 1;
    if (sz > maxi) {
      maxi = sz;
      best = e;
    }
  }
  cout << maxi << " " << best << endl;
}
