#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  long long i, j, n, m;
  string s;
  cin >> s;
  n = ((s).size());
  cin >> m;
  string b[m];
  for (int i = 0; i < m; i++) cin >> b[i];
  long long dp[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (((b[j]).size()) > i + 1) {
        if (i > 0)
          dp[i][j] = dp[i - 1][j];
        else
          dp[i][j] = -1;
      }
      long long pos = 1;
      for (int k = 0; k < ((b[j]).size()); k++) {
        if (s[i - k] != b[j][((b[j]).size()) - k - 1]) pos = 0;
      }
      if (pos)
        dp[i][j] = i;
      else if (i > 0)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = -1;
    }
  }
  long long fmaxi = 0;
  long long ind = 0;
  for (int i = 0; i < n; i++) {
    long long maxi = -1;
    for (int j = 0; j < m; j++) {
      if (dp[i][j] == -1) continue;
      long long st = dp[i][j] - ((b[j]).size()) + 1;
      maxi = max(maxi, st);
    }
    if (i - maxi > fmaxi) {
      fmaxi = i - maxi;
      ind = maxi + 1;
    }
  }
  swap(ind, fmaxi);
  cout << ind << " " << fmaxi;
  return 0;
}
