#include <bits/stdc++.h>
using namespace std;
char arr[100001];
int R[100001];
int dp[100001];
char ch[11];
int m;
int main() {
  scanf("%s", arr);
  int n = strlen(arr);
  scanf("%d", &m);
  for (int i = 0; i < n; i++) R[i] = 1000000000;
  while (m--) {
    scanf("%s", ch);
    int k = strlen(ch);
    for (int i = 0; i <= n - k; i++) {
      if (R[i] < k) continue;
      int j;
      for (j = 0; j < k && arr[j + i] == ch[j]; j++)
        ;
      if (j == k) R[i] = k;
    }
  }
  int idx = n;
  dp[n] = 0;
  for (int i = n - 1; i >= 0; i--) {
    dp[i] = min(R[i] - 1, dp[i + 1] + 1);
    if (dp[i] > dp[idx]) idx = i;
  }
  if (idx == n) idx = 0;
  cout << dp[idx] << " " << idx << endl;
  return 0;
}
