#include <bits/stdc++.h>
inline void swap(int &a, int &b) {
  int tmp;
  tmp = a;
  a = b;
  b = tmp;
}
using namespace std;
char ch1[100003];
char sub[10][11];
int ToPos[100003];
int fromPos[100003];
int len[10];
int n;
int sLen;
int main() {
  ch1[0] = '`';
  cin.getline(ch1 + 1, 100001);
  for (int x = 100000; x != -1; x--) {
    if (ch1[x]) {
      sLen = x + 1;
      break;
    }
  }
  cin >> n;
  cin.getline(sub[0], 11);
  for (int i = 0; i != n; i++) {
    cin.getline(sub[i], 11);
    for (int j = 0; j != 11; j++) {
      if (!sub[i][j]) {
        len[i] = j;
        break;
      }
    }
  }
  for (int i = 0; i != n; i++) {
    int tmpL = sLen - len[i] + 1;
    for (int j = 1; j < tmpL; j++) {
      bool ok = true;
      for (int z = 0; z != len[i]; z++) {
        if (ch1[j + z] != sub[i][z]) {
          ok = false;
          break;
        }
      }
      if (ok) {
        int val = j + len[i] - 1;
        if (ToPos[j]) {
          ToPos[j] = (ToPos[j] < val ? ToPos[j] : val);
        } else
          ToPos[j] = val;
        if (fromPos[val]) {
          fromPos[val] = (fromPos[val] > j ? fromPos[val] : j);
        } else
          fromPos[val] = j;
      }
    }
  }
  int maxLen = -1;
  int spos = 1;
  int nom = 0;
  for (int cv = 1; cv < sLen; cv++) {
    if (fromPos[cv] >= spos) {
      spos = fromPos[cv] + 1;
    } else {
      if (cv - spos > maxLen) {
        maxLen = cv - spos;
        nom = spos;
      }
    }
  }
  for (int cv = sLen - 1; cv != -1; cv--) {
    if (ToPos[cv]) {
      int tmp = sLen - cv - 2;
      if (maxLen < tmp) {
        maxLen = tmp;
        nom = cv;
      }
      break;
    }
  }
  maxLen++;
  nom--;
  if (maxLen) {
    cout << maxLen << ' ' << nom << endl;
  } else
    cout << "0 0" << endl;
  return 0;
}
