#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char ch = getchar();
  int nega = 1;
  while (!isdigit(ch)) {
    if (ch == '-') nega = -1;
    ch = getchar();
  }
  int ans = 0;
  while (isdigit(ch)) {
    ans = ans * 10 + ch - 48;
    ch = getchar();
  }
  if (nega == -1) return -ans;
  return ans;
}
void print(vector<int> x) {
  for (int i = 0; i < (int)x.size(); i++)
    printf("%d%c", x[i], " \n"[i == (int)x.size() - 1]);
}
char ss[1000005], tt[1000005], s[1000005];
int ch[1000005][26], fa[1000005], len[1000005], dif[1000005], tp[1000005], cnt,
    las, n;
int pos[1000005], p[1000005], f[1000005], fr[1000005];
signed main() {
  scanf("%s%s", ss + 1, tt + 1);
  n = strlen(ss + 1);
  for (int i = 1; i <= n; i++) s[i * 2 - 1] = ss[i], s[i * 2] = tt[i];
  n *= 2;
  cnt = las = 2, len[1] = -1, fa[1] = fa[2] = 1;
  for (int i = 1; i <= n; i++) {
    while (s[i] != s[i - len[las] - 1]) las = fa[las];
    if (!ch[las][s[i] - 'a']) {
      int tmp = fa[las];
      cnt++;
      while (tmp && s[i] != s[i - len[tmp] - 1]) tmp = fa[tmp];
      fa[cnt] = ch[tmp][s[i] - 'a'] ? ch[tmp][s[i] - 'a'] : 2;
      ch[las][s[i] - 'a'] = cnt, len[cnt] = len[las] + 2;
      dif[cnt] = len[cnt] - len[fa[cnt]];
      tp[cnt] = dif[cnt] == dif[fa[cnt]] ? tp[fa[cnt]] : fa[cnt];
    }
    las = ch[las][s[i] - 'a'], pos[i] = las;
  }
  memset(f, 0x3f, sizeof(f));
  f[0] = 0;
  p[1] = p[2] = 1;
  for (int i = 1; i <= n; i++) {
    if (i % 2 == 0 && s[i - 1] == s[i] && f[i - 2] < f[i])
      f[i] = f[i - 2], fr[i] = i - 2;
    for (int j = pos[i]; j > 2; j = tp[j]) {
      p[j] = i - len[tp[j]] - dif[j];
      if (dif[j] == dif[fa[j]] && f[p[fa[j]]] < f[p[j]]) p[j] = p[fa[j]];
      if (i % 2 == 0 && f[p[j]] + 1 < f[i]) f[i] = f[p[j]] + 1, fr[i] = p[j];
    }
  }
  if (f[n] >= 0x3f3f3f3f)
    cout << "-1\n";
  else {
    cout << f[n] << endl;
    int cur = n;
    while (cur) {
      int las = fr[cur];
      if (cur - las > 2) printf("%d %d\n", las / 2 + 1, cur / 2);
      cur = las;
    }
  }
  return 0;
}
