#include <bits/stdc++.h>
using namespace std;
string s;
int n;
vector<string> v;
int bpos, blen;
int lpos, rpos;
const int maxlen = 100100;
const int maxn = 10;
bool d[maxlen][maxn];
inline bool is(int num, int pos) {
  if (v[num].size() > s.size() - pos) {
    return false;
  }
  for (int i = 0; i < v[num].size(); i++) {
    if (v[num][i] != s[pos + i]) {
      return false;
    }
  }
  return true;
}
bool comp(const string &s1, const string &s2) { return s1.size() < s2.size(); }
inline bool may(int l, int r) {
  for (int i = 0; i < n; i++) {
    if (v[i].size() <= r - l) {
      if (d[r - v[i].size()][i]) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  cin >> s;
  cin >> n;
  v.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end(), comp);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < s.size(); j++) {
      if (is(i, j)) {
        d[j][i] = true;
      }
    }
  }
  lpos = 0, rpos = 0;
  while (lpos < s.size()) {
    if (rpos < lpos) rpos = lpos;
    while (rpos + 1 <= s.size() && may(lpos, rpos + 1)) {
      rpos++;
    }
    if (rpos - lpos > blen) {
      bpos = lpos, blen = rpos - lpos;
    }
    lpos++;
  }
  cout << blen << " " << bpos;
}
