#include <bits/stdc++.h>
using namespace std;
string a[100001];
int b;
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int l = 0;
  int r = -1;
  int ans = 0;
  while (s.size() - r > 1) {
    int ok = -1;
    r++;
    for (int i = 1; i <= n; i++) {
      if (a[i].size() > r - l + 1) continue;
      int cur = r;
      int sum = 0;
      for (int j = a[i].size() - 1; j >= 0; j--) {
        if (a[i][j] != s[cur]) {
          break;
        }
        cur--;
        sum++;
      }
      if (sum == a[i].size()) {
        int len = r - a[i].size() + 1;
        ok = max(ok, len);
      }
    }
    if (ok >= 0) {
      l = ok + 1;
    }
    if (r < s.size() && l < s.size()) {
      if (ans < r - l + 1) {
        b = l;
        ans = r - l + 1;
      }
    }
  }
  cout << ans << ' ' << b;
  return 0;
}
