#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
long long power(long long a, long long b) {
  long long res = 1;
  a = a % 1000000007;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % 1000000007;
      b--;
    }
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res;
}
long long fermat_inv(long long y) { return power(y, 1000000007 - 2); }
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tt, i, j, k, n, m, x, y, ans;
  tt = 1;
  while (tt--) {
    string s;
    cin >> s;
    cin >> n;
    vector<string> v(n);
    for (long long p = 0; p < n; p++) cin >> v[p];
    long long l = 0, p = 0;
    ans = 0;
    for (long long r = 0; r < s.size(); r++) {
      for (long long q = 0; q < n; q++) {
        if (v[q].size() <= r - l + 1 &&
            v[q] == s.substr(r - v[q].size() + 1, v[q].size()))
          l = r - v[q].size() + 2;
      }
      if (r - l + 1 > ans) {
        ans = r - l + 1;
        p = l;
      }
    }
    cout << ans << " " << p;
  }
  return 0;
}
