#include <bits/stdc++.h>
using namespace std;
string str, a[20];
int n, l, r, len, pos, i;
int main() {
  cin >> str >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int r = 0; r < str.size(); r++) {
    int np = l;
    for (int i = 0; i < n; i++) {
      if (a[i].size() <= r - l + 1 &&
          str.substr(r - a[i].size() + 1, a[i].size()) == a[i]) {
        np = max(np, r - (int)a[i].size() + 2);
      }
    }
    l = max(l, np);
    if (r - l + 1 > len) {
      len = r - l + 1;
      pos = l;
    }
  }
  cout << len << " " << pos << endl;
}
