#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<int> v[s.size()];
  int n, cont = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string z;
    cin >> z;
    for (int j = 0; j < (int)s.size() - (int)z.size() + 1; ++j) {
      int k = 0;
      while (k < z.size() && s[j + k] == z[k]) k++;
      if (k == z.size() && s[j + k - 1] == z[k - 1])
        v[j].push_back(cont), v[j + k - 1].push_back(cont), cont++;
    }
  }
  vector<int> cnt(cont, 0);
  int pass = 0;
  for (auto x : v[0]) {
    cnt[x]++;
    if (cnt[x] == 2) pass++;
  }
  pair<int, int> ans{0, 0};
  int r = 0;
  for (int i = 0; i < s.size(); ++i) {
    while (!pass) {
      ans = max(ans, make_pair(r - i + 1, i));
      r++;
      if (r == s.size()) break;
      for (auto x : v[r]) {
        cnt[x]++;
        if (cnt[x] == 2) pass++;
      }
    }
    if (r == s.size()) break;
    for (auto x : v[i]) {
      if (cnt[x] == 2) pass--;
      cnt[x]--;
    }
  }
  cout << ans.first << " " << ans.second;
}
