#include <bits/stdc++.h>
using namespace std;
vector<int> a[100010];
int res[100010] = {0};
int main() {
  cin.sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.size();
  s = " " + s;
  s += "$$$$$$$$$$@#@Avadakedavra!!@#@$$$";
  vector<string> ks;
  int m;
  cin >> m;
  for (int i = 1; i <= m; i++) {
    string t;
    cin >> t;
    ks.push_back(t);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < ks.size(); j++) {
      string t = ks[j];
      if (s.substr(i, t.size()) == t) a[i].push_back(t.size());
    }
  }
  int ans = 0, mind = 0;
  for (int i = n; i > 0; i--) {
    int x = res[i + 1] + 1;
    vector<int> v = a[i];
    for (int j = 0; j < v.size(); j++) x = min(x, v[j] - 1);
    res[i] = x;
    if (x >= ans) mind = i;
    ans = max(ans, x);
  }
  cout << ans << " " << mind - 1 << endl;
}
