#include <bits/stdc++.h>
using namespace std;
void read(vector<long long> &v) {
  for (int i = 0; i < v.size(); i++) cin >> v[i];
}
void print(vector<long long> v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
}
long long n, m, a, b, temp, x, y;
string str;
set<string> strings;
unordered_map<string, vector<int>> mp;
bool check(int l, int r) {
  for (auto s : strings) {
    if (r - l + 1 < s.size()) continue;
    auto it = lower_bound(mp[s].begin(), mp[s].end(), l);
    if (it == mp[s].end()) continue;
    int val = *it;
    if (val <= (r - s.size() + 1)) return 0;
  }
  return 1;
}
int start;
int solve() {
  int l = 0;
  int r = 0;
  int ans = 0;
  for (int l = 0; l < str.size(); l++) {
    while (r < l) r++;
    if (!check(l, r)) {
      if (r - l > ans) {
        ans = r - l;
        start = l;
      }
      continue;
    }
    while (r < str.size()) {
      if (check(l, r))
        r++;
      else
        break;
    }
    if (r - l > ans) {
      ans = r - l;
      start = l;
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> str;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    strings.insert(s);
  }
  for (auto s : strings) {
    string temp;
    if (s.size() > str.size()) continue;
    for (int i = 0; i <= str.length() - s.length(); i++) {
      temp = str.substr(i, s.length());
      if (temp == s) mp[s].push_back(i);
    }
  }
  long long ans = solve();
  cout << ans << ' ' << start;
}
