#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
string s1;
int len = 0, pos = 0;
string b[10];
bool good[10];
bool check(int pos, int sec) {
  if (b[sec].size() > s1.size() - pos) {
    return false;
  }
  for (int i = 0; i < b[sec].size(); i++) {
    if (s1[pos + i] != b[sec][i]) {
      return false;
    }
  }
  return true;
}
int main() {
  cin >> s1;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) {
        continue;
      }
      if (b[i] != b[j] && b[i].find(b[j]) != -1) {
        good[i] = true;
      }
    }
  }
  int last = 0;
  for (int i = 0; i < s1.size(); i++) {
    int mx = 1 << 30;
    for (int j = 0; j < n; j++) {
      if (!good[j] && check(i, j)) {
        mx = min(mx, (int)b[j].size());
      }
    }
    if (mx != 1 << 30) {
      if (len < last + mx - 1) {
        len = last + mx - 1;
        pos = i - last;
      }
      last = 0;
    } else {
      last++;
    }
  }
  if (len < last) {
    len = last;
    pos = s1.size() - last;
  }
  cout << len << " " << pos << endl;
  return 0;
}
