#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int> > V;
  string s;
  cin >> s;
  s += '#';
  int n;
  cin >> n;
  vector<string> a(n);
  for (register int i = (0); i < (int)n; ++i) cin >> a[i];
  n++;
  a.push_back("#");
  for (register int i = (0); i < (int)((int)(s).size()); ++i) {
    int mx = -1;
    for (register int j = (0); j < (int)n; ++j)
      if (i + 1 >= ((int)(a[j]).size())) {
        bool match = true;
        int beg = i - ((int)(a[j]).size()) + 1;
        for (register int k = (0); k < (int)((int)(a[j]).size()); ++k)
          if (s[beg + k] != a[j][k]) match = false;
        if (match) mx = max(mx, beg);
      }
    if (mx != -1) V.push_back(make_pair(mx, i));
  }
  int end = 0, cur = 0, best = 0, pos = 0;
  for (register int i = (0); i < (int)((int)(s).size()); ++i) {
    int start = i;
    while (end < ((int)(s).size()) && cur < ((int)(V).size()) &&
           end <= V[cur].second) {
      if (end == V[cur].second) {
        if (V[cur].first >= start)
          break;
        else
          cur++;
      } else
        end++;
    }
    if (end - start > best) {
      best = end - start;
      pos = start;
    }
  }
  if (((int)(V).size()) == 0)
    cout << ((int)(s).size()) << " " << 0 << endl;
  else
    cout << best << " " << pos << endl;
  return 0;
}
