#include <bits/stdc++.h>
using namespace std;
char ss[100050];
char b[12][12];
int len[12];
int n, m;
bool g[100050][11];
bool f[100050][11];
int dp[100050];
struct Node {
  int a, b;
};
int main() {
  int ll, pos;
  bool tmp;
  scanf("%s", ss);
  n = strlen(ss);
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%s", b[i]);
    len[i] = strlen(b[i]);
  }
  memset(f, false, sizeof(f));
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= 10 && i - j + 1 >= 0; j++) f[i][j] = true;
    for (int j = 0; j < m; j++) {
      if (i + 1 >= len[j]) {
        tmp = true;
        for (int k = 0; k < len[j]; k++) {
          if (ss[i + k + 1 - len[j]] != b[j][k]) {
            tmp = false;
            break;
          }
        }
        if (tmp) f[i][len[j]] = false;
      }
    }
    if (!i)
      dp[i] = 1;
    else
      dp[i] = dp[i - 1] + 1;
    for (int j = 1; j <= 10 && i + 1 >= j; j++)
      if (!f[i][j]) {
        dp[i] = j - 1;
        break;
      }
  }
  Node ans;
  ans.a = ans.b = 0;
  pos = 0;
  for (int i = 0; i < n; i++) {
    pos = max(pos, i - dp[i] + 1);
    if (i - pos + 1 > 0 && i - pos + 1 >= ans.b) {
      ans.a = pos;
      ans.b = i - pos + 1;
    }
  }
  printf("%d %d\n", ans.b, ans.a);
  return 0;
}
