#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  bool t = false;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = true, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return t ? -x : x;
}
char A[1000100], B[1000100], s[1000100];
int f[1000100], g[1000100], tr[1000100], n;
struct Node {
  int son[26], ff, len;
  void clear() {
    ff = len = 0;
    memset(son, 0, sizeof(son));
  }
} t[1000100];
int last, tot, diff[1000100], anc[1000100];
void extend(int c, int n, char *s) {
  int p = last;
  while (s[n] != s[n - t[p].len - 1]) p = t[p].ff;
  if (!t[p].son[c]) {
    int v = ++tot, k = t[p].ff;
    t[v].len = t[p].len + 2;
    while (s[n] != s[n - t[k].len - 1]) k = t[k].ff;
    t[v].ff = t[k].son[c];
    t[p].son[c] = v;
    diff[v] = t[v].len - t[t[v].ff].len;
    anc[v] = diff[v] == diff[t[v].ff] ? anc[t[v].ff] : t[v].ff;
  }
  last = t[p].son[c];
}
int Min(int x, int y) {
  if (x == -1) return y;
  if (y == -1) return x;
  return f[x] < f[y] ? x : y;
}
int main() {
  scanf("%s", A + 1);
  scanf("%s", B + 1);
  n = 0;
  t[tot = 1].len = -1;
  t[0].ff = t[1].ff = 1;
  anc[0] = 1;
  last = 0;
  for (int i = 1, l = strlen(A + 1); i <= l; ++i) s[++n] = A[i], s[++n] = B[i];
  for (int i = 0; i <= n + 1; ++i) g[i] = -1;
  for (int i = 1; i <= n; ++i) {
    f[i] = 1e9;
    if (i > 1 && s[i] == s[i - 1]) f[i] = min(f[i], f[i - 2]), tr[i] = i - 2;
    extend(s[i] - 97, i, s);
    for (int k = last; k; k = anc[k]) {
      g[k] = i - t[anc[k]].len - diff[k];
      if (anc[k] != t[k].ff) g[k] = Min(g[k], g[t[k].ff]);
      if ((~g[k]) && f[g[k]] + 1 < f[i] && (~i & 1))
        f[i] = f[g[k]] + 1, tr[i] = g[k];
    }
  }
  if (f[n] >= 1e9)
    puts("-1");
  else {
    printf("%d\n", f[n]);
    for (int i = n; i; i = tr[i])
      if (tr[i] != i - 2) printf("%d %d\n", (tr[i] >> 1) + 1, i >> 1);
  }
  return 0;
}
