#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int inf = ~0u >> 2;
char ss[N], tt[N], s[N];
namespace PAM {
struct node {
  int tr[26];
  int fail, len, slink;
} G[N];
int f[N], g[N], d[N];
int sol[N];
int last, tot;
void init() {
  last = 0, tot = 1;
  G[0].len = 0, G[1].len = -1;
  G[0].fail = 1, G[1].fail = 0;
  G[0].slink = 1, G[1].slink = 0;
}
void insert(char c, int x) {
  int p = last;
  while (s[x] != s[x - G[p].len - 1]) p = G[p].fail;
  int b = c - 'a';
  if (!G[p].tr[b]) {
    int q = ++tot;
    G[q].len = G[p].len + 2;
    int _p = G[p].fail;
    while (s[x] != s[x - G[_p].len - 1]) _p = G[_p].fail;
    G[q].fail = G[_p].tr[b];
    d[q] = G[q].len - G[G[q].fail].len;
    if (d[q] == d[G[q].fail])
      G[q].slink = G[G[q].fail].slink;
    else
      G[q].slink = G[q].fail;
    G[p].tr[b] = q;
  }
  last = G[p].tr[b];
  if (!(x & 1) && s[x] == s[x - 1] && f[x] > f[x - 2])
    f[x] = f[x - 2], sol[x] = x - 2;
  int _p = last;
  while (_p >= 2) {
    g[_p] = x - G[G[_p].slink].len - d[_p];
    if (G[_p].slink != G[_p].fail && f[g[_p]] > f[g[G[_p].fail]])
      g[_p] = g[G[_p].fail];
    if (!(x & 1) && f[x] > f[g[_p]] + 1) f[x] = f[g[_p]] + 1, sol[x] = g[_p];
    _p = G[_p].slink;
  }
}
}  // namespace PAM
using namespace PAM;
int main() {
  memset(f, 127, sizeof(f));
  f[0] = 0;
  init();
  scanf("%s", ss + 1);
  scanf("%s", tt + 1);
  int len = strlen(ss + 1);
  int l1 = 1, l2 = 1;
  for (int i = 1; i <= len * 2; i++)
    s[i] = i & 1 ? ss[l1++] : tt[l2++], insert(s[i], i);
  if (f[len << 1] > inf) return puts("-1"), 0;
  cout << f[len * 2] << endl;
  for (int i = len * 2; i; i = sol[i])
    if (i - sol[i] > 2) printf("%d %d\n", sol[i] / 2 + 1, i >> 1);
  return 0;
}
