#include <bits/stdc++.h>
using namespace std;
struct S {
  int endPos;
  int startPos;
  S(int a = 0, int b = 0) : endPos(b), startPos(a){};
};
int compByStartAndEnd(const S &p1, const S &p2) {
  if (p1.endPos < p2.endPos) return 1;
  if (p1.endPos == p2.endPos && p1.startPos < p2.startPos) return 1;
  return 0;
}
int compLower(const S &p1, const S &p2) {
  if (p1.endPos < p2.endPos) return 1;
  return 0;
}
int strInSize;
char strIn[int(1e5) + 10];
int n;
char words[20][20];
int wordsSize[20];
S entryPos[int(1e6) + 10];
int entryPosSize = 0;
void task() {
  scanf("%s", strIn);
  strInSize = strlen(strIn);
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", words[i]);
    wordsSize[i] = strlen(words[i]);
  }
  for (int i = 0; i < strInSize; ++i)
    for (int j = 0; j < n; ++j) {
      int ok = 1;
      if (i + wordsSize[j] - 1 >= strInSize) ok = 0;
      for (int k = 0; k < wordsSize[j]; ++k)
        if (words[j][k] != strIn[i + k]) ok = 0;
      if (ok) {
        entryPos[entryPosSize].startPos = i;
        entryPos[entryPosSize].endPos = i + wordsSize[j] - 1;
        ++entryPosSize;
      }
    }
  sort(entryPos, entryPos + entryPosSize, compByStartAndEnd);
  int ansLen = 0;
  int ansPos = 0;
  S *start = entryPos;
  for (int i = 0; i < strInSize; ++i) {
    S *end = entryPos + entryPosSize;
    S *it = lower_bound(start, end, S(i, 0), compByStartAndEnd);
    while (it != end) {
      if (it->startPos >= i) break;
      ++it;
    }
    start = it;
    int len = strInSize - i;
    int pos = i;
    if (it != end) {
      len = it->endPos - i;
    }
    if (len > ansLen) {
      ansLen = len;
      ansPos = pos;
    }
  }
  cout << ansLen << ' ' << ansPos << "\n";
}
int main() {
  task();
  return 0;
}
