#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
long long p[20000000];
long long prevv[2000000];
long long _hash[100000 + 5];
long long dp[100000 + 5];
long long power(long long a, long long n) {
  long long ans = 1;
  long long k = a;
  while (n) {
    if (n & 1) {
      ans *= k;
      ans %= mod;
    }
    n /= 2;
    k *= k;
    k %= mod;
  }
  ans = (ans + mod) % mod;
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  p[0] = 1;
  for (int i = 1; i < 100000 + 5; i++) {
    p[i] = p[i - 1] * 97;
    p[i] %= mod;
  }
  for (int i = 0; i < 100000 + 5; i++) {
    prevv[i] = power(p[i], mod - 2);
  }
  string s;
  cin >> s;
  int n = s.size();
  int q;
  cin >> q;
  vector<pair<long long, long long> > rt;
  for (int i = 0; i < q; i++) {
    string t;
    cin >> t;
    long long hsh = 0;
    for (int j = 0; j < t.size(); j++) {
      hsh += ((t[j] - '_' + 1) * p[j]) % mod;
      hsh %= mod;
    }
    hsh = (hsh + mod) % mod;
    rt.push_back({t.size(), hsh});
  }
  sort(rt.begin(), rt.end());
  for (int i = 0; i < s.size(); i++) {
    _hash[i + 1] = ((s[i] - '_' + 1) * p[i]) % mod;
    _hash[i + 1] += _hash[i];
    _hash[i + 1] %= mod;
  }
  for (int i = 1; i <= n; i++) {
    bool f = true;
    int md;
    for (int j = 0; j < q; j++) {
      if (i < rt[j].first) continue;
      if (i - rt[j].first + 1 < (i - 1) - dp[i - 1] + 1) continue;
      long long hsh = _hash[i] - _hash[i - rt[j].first];
      hsh %= mod;
      hsh *= prevv[i - rt[j].first];
      hsh %= mod;
      hsh = (hsh + mod) % mod;
      md = rt[j].first;
      if (hsh == rt[j].second) {
        f = false;
        break;
      }
    }
    if (f == true)
      dp[i] = dp[i - 1] + 1;
    else {
      dp[i] = md - 1;
    }
  }
  int pos = 1, mmax = 0;
  for (int i = 1; i <= n; i++) {
    if (dp[i] > mmax) {
      mmax = dp[i];
      pos = i - dp[i] + 1;
    }
  }
  cout << mmax << " " << (pos - 1) << endl;
  return 0;
}
