#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<string> b(n);
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  vector<string::size_type> hoge(s.length(), s.length());
  for (int i = 0; i < n; ++i) {
    string::size_type p = 0;
    for (;;) {
      p = s.find(b[i], p);
      if (p == string::npos) break;
      string::size_type x = p + b[i].length() - 1;
      for (vector<string::size_type>::iterator j =
               upper_bound(hoge.begin(), hoge.end(), x);
           j <= hoge.begin() + p; ++j) {
        *j = min(*j, x);
      }
      ++p;
    }
  }
  int r1 = 0, r2 = 0;
  for (int i = 0; i < s.length(); ++i) {
    if (hoge[i] - i > r1) {
      r1 = hoge[i] - i;
      r2 = i;
    }
  }
  cout << r1 << " " << r2 << endl;
}
