#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, len = 0, length = 0, pos = 0;
  string s;
  cin >> s >> n;
  vector<string> b(n);
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  sort(b.begin(), b.end());
  for (int i = s.length() - 1, j; i >= 0; i--) {
    for (j = 0, length++; j < n; j++) {
      if (length >= b[j].length() && b[j] == s.substr(i, b[j].length())) {
        break;
      }
    }
    if (j == n && length > len) {
      len = length;
      pos = i;
    } else if (j != n) {
      length = b[j].length() - 1;
    }
  }
  cout << len << ' ' << pos;
}
