#include <bits/stdc++.h>
using namespace std;
char s[100001];
char word[12][12];
int main() {
  gets(s);
  int n = strlen(s), m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%s", word[i]);
  }
  int l = 0, r = 0, ans = 0, first = 0;
  for (; r < n; r++) {
    int pos = -1;
    for (int i = 0; i < m; i++) {
      int len = strlen(word[i]);
      if (r - len + 1 < 0) continue;
      bool match = 1;
      for (int j = 0; j < len; j++) {
        if (s[r - (len - j - 1)] != word[i][j]) {
          match = 0;
          break;
        }
      }
      if (match) {
        pos = max(pos, r - len + 2);
      }
    }
    if (pos != -1) {
      l = max(l, pos);
    }
    if (r - l + 1 > ans) {
      ans = r - l + 1;
      first = l;
    }
  }
  printf("%d %d\n", ans, first);
}
