#include <bits/stdc++.h>
using namespace std;
string world[8] = {"U", "D", "R", "L", "UL", "UR", "DR", "DL"};
const int rx[8] = {-1, 1, 0, 0, -1, -1, 1, 1};
const int ry[8] = {0, 0, 1, -1, -1, 1, 1, -1};
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  int n;
  cin >> n;
  string a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int pos = s.length(), len = 0;
  int l = 0;
  for (int i = 0; i < s.length(); i++) {
    for (int j = 0; j < n; j++) {
      if (a[j].size() - 1 <= i)
        if (a[j] == s.substr(i - a[j].size() + 1, a[j].size())) {
          l = max(l, int(i - a[j].size() + 2));
        }
    }
    if (l <= i && i - l + 1 > len) {
      len = i - l + 1;
      pos = l;
    }
  }
  cout << len << " " << pos << endl;
  return 0;
}
