#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("popcnt")
struct Timer {
  chrono::time_point<chrono::high_resolution_clock> start, end;
  chrono::duration<float> dur;
  Timer() { start = chrono::high_resolution_clock::now(); }
  ~Timer() {
    end = chrono::high_resolution_clock::now();
    dur = end - start;
    cout << "\nTime Elapsed : " << dur.count() << " s\n";
  }
};
long long int sum() { return 0; }
template <typename T, typename... Args>
T sum(T a, Args... args) {
  return a + sum(args...);
}
template <typename T>
void getVector(vector<T>& a, int st, int en) {
  int dif = (en > st ? 1 : -1);
  for (int i = st; i != en; i += dif) cin >> a[i];
}
template <typename T>
void getVecPair(vector<pair<T, T>>& a, int st, int en) {
  int dif = (en > st ? 1 : -1);
  for (int i = st; i != en; i += dif) cin >> a[i].first >> a[i].second;
}
template <int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template <typename... Args>
  Vec(int n = 0, Args... args)
      : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {}
};
template <typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, T val = T()) : vector<T>(n, val) {}
};
vector<int> z_function(string& s) {
  int n = s.length();
  vector<int> z(n, 0);
  for (int i = 1, l = 0, r = 0; i < n; i++) {
    if (i <= r) z[i] = min(z[i - l], r - i + 1);
    while (i + z[i] < n && s[i + z[i]] == s[z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(10);
  cout << fixed;
  int testCases = 1;
  while (testCases--) {
    string s;
    cin >> s;
    int n_ = s.length();
    int n;
    cin >> n;
    vector<bool> ans(n_, true);
    vector<int> minStarting(n_, n_);
    for (int i = 0; i < n; i++) {
      string pat;
      cin >> pat;
      string tmp = pat + "#" + s;
      vector<int> z = z_function(tmp);
      for (int i = 1; i <= n_; i++) {
        if (z[pat.size() + i] == pat.size())
          ans[i - 1] = false, minStarting[i - 1] =
                                  min(minStarting[i - 1], (int)pat.size() - 1);
      }
    }
    vector<int> pref(n_);
    for (int i = 0; i < n_; i++)
      if (ans[i]) pref[i] = 1 + (i > 0 ? pref[i - 1] : 0);
    int longestLength = 0, pos = 0;
    for (int i = n_ - 1; i >= 0; i--) {
      if (i + 1 < n_)
        minStarting[i] = min(minStarting[i], 1 + minStarting[i + 1]);
    }
    for (int i = 0; i < n_; i++) {
      int cur = 0;
      if (ans[i] != 0) {
        cur = pref[i];
        if (i + 1 < n_ && ans[i + 1] == 0) cur += minStarting[i + 1];
        if (cur > longestLength) {
          longestLength = cur;
          pos = i - pref[i] + 1;
        }
      } else {
        cur = minStarting[i];
        if (cur > longestLength) {
          longestLength = cur;
          pos = i;
        }
      }
    }
    cout << longestLength << " " << pos << "\n";
  }
}
