#include <bits/stdc++.h>
using namespace std;
string s, a[20], f[20][20];
int big, jadid, toolbig, tooljadid, flag, p, n, tedad[20];
int main() {
  cin >> s >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    tedad[a[i].size()]++;
    f[a[i].size()][tedad[a[i].size()]] = a[i];
  }
  flag = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i][0] == s[0] && a[i].size() == 1) {
      flag = 1;
    }
  }
  if (flag == 0) {
    jadid = 0;
    big = 0;
    tooljadid = 1;
    toolbig = 1;
  } else {
    tooljadid = -1;
  }
  flag = 0;
  for (int i = 1; i < s.size(); i++) {
    if (tooljadid == -1) {
      flag = 0;
      for (int j = 1; j <= n; j++) {
        if (s[i] == a[j][0] && a[j].size() == 1) {
          flag = 1;
        }
      }
      if (!flag) {
        tooljadid = 1;
        jadid = i;
      }
    } else {
      flag = 0;
      for (int j = 1; j <= n; j++) {
        if (s[i] == a[j][0] && a[j].size() == 1) {
          flag = 1;
        }
      }
      if (flag) {
        tooljadid = -1;
      } else {
        flag = 0;
        for (int j = 1; j <= 10 && i - j + 1 >= jadid; j++) {
          for (int k = 1; k <= tedad[j]; k++) {
            if (f[j][k] == s.substr(i - j + 1, j)) {
              p = i - j + 1;
              flag = 1;
              break;
            }
          }
          if (flag) {
            break;
          }
        }
        if (flag) {
          jadid = p + 1;
          tooljadid = i - p;
        } else {
          tooljadid++;
        }
      }
    }
    if (tooljadid > toolbig) {
      toolbig = tooljadid;
      big = jadid;
    }
  }
  cout << toolbig << " " << big << endl;
  return 0;
}
