#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3fffffff;
int n, len;
int f[1000006], dp[1000006];
char s[1000006], b[20][20];
int main() {
  scanf("%s%d", s, &n);
  len = strlen(s);
  for (int i = 0; i < n; i++) scanf("%s", b[i]);
  fill(f, f + len, inf);
  for (int i = 0; i < n; i++) {
    int ln = strlen(b[i]);
    for (int j = 0; j + ln <= len; j++) {
      int r;
      for (r = 0; r < ln; r++)
        if (s[j + r] != b[i][r]) break;
      if (r >= ln) f[j + ln - 1] = min(f[j + ln - 1], ln);
    }
  }
  dp[0] = (f[0] == inf);
  int ans = dp[0], pos = 0, pre = 0;
  for (int i = 1; i < len; i++) {
    if (f[i] > i - pre + 1)
      dp[i] = dp[i - 1] + 1;
    else
      dp[i] = min(f[i] - 1, i - pre), pre = max(pre, i - f[i] + 2);
    if (ans < dp[i]) ans = dp[i], pos = i - dp[i] + 1;
  }
  printf("%d %d", ans, pos);
  return 0;
}
