#include <bits/stdc++.h>
using namespace std;
string multiply(string num1, string num2) {
  int len1 = num1.size();
  int len2 = num2.size();
  if (len1 == 0 || len2 == 0) return "0";
  vector<int> result(len1 + len2, 0);
  int i_n1 = 0;
  int i_n2 = 0;
  for (int i = len1 - 1; i >= 0; i--) {
    int carry = 0;
    int n1 = num1[i] - '0';
    i_n2 = 0;
    for (int j = len2 - 1; j >= 0; j--) {
      int n2 = num2[j] - '0';
      int sum = n1 * n2 + result[i_n1 + i_n2] + carry;
      carry = sum / 10;
      result[i_n1 + i_n2] = sum % 10;
      i_n2++;
    }
    if (carry > 0) result[i_n1 + i_n2] += carry;
    i_n1++;
  }
  int i = result.size() - 1;
  while (i >= 0 && result[i] == 0) i--;
  if (i == -1) return "0";
  string s = "";
  while (i >= 0) s += std::to_string(result[i--]);
  return s;
}
int isPrime(long long int n) {
  if (n <= 1) return 0;
  for (long long int i = 2; i < n; i++)
    if (n % i == 0) return 0;
  return 1;
}
long long int modFact(long long int n, long long int p) {
  if (n >= p) return 0;
  long long int result = 1;
  for (long long int i = 1; i <= n; i++) result = (result * i) % p;
  return result;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  long long int n;
  cin >> n;
  vector<string> v;
  for (long long int i = 0; i < n; i++) {
    string s1;
    cin >> s1;
    v.push_back(s1);
  }
  vector<long long int> ans;
  long long int l = 0;
  long long int m = -1;
  long long int p = -1;
  for (long long int i = 0; i < s.length(); i++) {
    for (long long int j = 0; j < n; j++) {
      long long int x = v[j].size();
      if (x <= i - (l - 1) && s.substr(i - x + 1, x) == v[j]) {
        l = i - x + 2;
      }
    }
    if (i - l + 1 > m) {
      m = i - l + 1;
      p = l;
    }
  }
  if (m > 0)
    cout << m << " " << p;
  else
    cout << 0 << " " << 0;
  return 0;
}
