#include <bits/stdc++.h>
using namespace std;
int max_ans = -1;
int poz = -1;
string bore[10 + 5];
int n;
string s;
int main() {
  ios::sync_with_stdio(false);
  cin >> s >> n;
  for (int i = 0; i < n; i++) cin >> bore[i];
  int st = 0;
  for (int ed = 0; ed < s.size(); ed++) {
    for (int j = 0; j < n; j++)
      if ((int)bore[j].size() <= ed - st + 1 &&
          s.substr(ed - bore[j].size() + 1, bore[j].size()) == bore[j])
        st = ed - bore[j].size() + 2;
    if (ed - st + 1 > max_ans) {
      max_ans = ed - st + 1;
      poz = st;
    }
  }
  cout << max_ans << ' ' << poz << endl;
  return 0;
}
