#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, ans, ind, d[100000];
bool f[100000];
string s, b[20];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s >> n;
  for (i = 0; i < n; i++) {
    cin >> b[i];
    for (j = 0; j < int(s.size()) - int(b[i].size()) + 1; j++) {
      for (k = 0; k < b[i].size() && s[j + k] == b[i][k]; k++)
        ;
      if (k == b[i].size()) {
        d[j + int(b[i].size()) - 1] = max(j, d[j + int(b[i].size()) - 1]);
        f[j + int(b[i].size()) - 1] = true;
      }
    }
  }
  j = 0;
  for (i = 0; i < s.size(); i++) {
    if (f[i]) j = max(j, d[i] + 1);
    if (ans < i - j + 1) {
      ans = i - j + 1;
      ind = j;
    }
  }
  cout << ans << endl << ind;
  return 0;
}
