#include <bits/stdc++.h>
inline int in() {
  int k = 0;
  char ch = getchar();
  while (ch < '-') ch = getchar();
  while (ch > '-') k = k * 10 + ch - '0', ch = getchar();
  return k;
}
const int N = 1e6 + 5, inf = 1e9;
int ch[N][26], fa[N], len[N], anc[N], dif[N], tot, lst, p, np, pr[N];
char str[N];
inline void init() {
  for (int i = 0; i <= tot; ++i)
    memset(ch[i], len[i] = fa[i] = 0, sizeof ch[i]);
  fa[0] = fa[1] = 1, len[tot = 1] = -1, anc[0] = 1, lst = 0;
}
inline void extend(int c, int n) {
  p = lst;
  while (str[n] != str[n - len[p] - 1]) p = fa[p];
  if (!ch[p][c]) {
    len[np = ++tot] = len[p] + 2;
    int k = fa[p];
    while (str[n] != str[n - len[k] - 1]) k = fa[k];
    fa[np] = ch[k][c], ch[p][c] = np;
    dif[np] = len[np] - len[fa[np]];
    anc[np] = dif[np] == dif[fa[np]] ? anc[fa[np]] : fa[np];
  }
  lst = ch[p][c];
}
int f[N], g[N];
inline int cmp(const int &x, const int &y) {
  if (x == -1) return y;
  if (y == -1) return x;
  return f[x] < f[y] ? x : y;
}
inline void work() {
  static char A[N], B[N];
  scanf("%s%s", A + 1, B + 1);
  int n = 0;
  for (int i = 1, l = strlen(A + 1); i <= l; ++i)
    str[++n] = A[i], str[++n] = B[i];
  memset(g, -1, n + 2 << 2);
  for (int i = 1; i <= n; ++i) {
    f[i] = inf;
    extend(str[i] - 'a', i);
    if (i > 1 && str[i] == str[i - 1]) f[i] = f[i - 2], pr[i] = i - 2;
    for (int k = lst; k; k = anc[k]) {
      g[k] = i - len[anc[k]] - dif[k];
      if (anc[k] != fa[k]) g[k] = cmp(g[k], g[fa[k]]);
      if (g[k] == -1 || (i & 1)) continue;
      if (f[g[k]] + 1 < f[i]) f[i] = f[g[k]] + 1, pr[i] = g[k];
    }
  }
  if (f[n] >= inf)
    puts("-1");
  else {
    printf("%d\n", f[n]);
    for (int i = n; i; i = pr[i])
      if (pr[i] != i - 2) printf("%d %d\n", (pr[i] >> 1) + 1, i >> 1);
  }
}
int main() {
  for (int t = 1; t; --t) init(), work();
  return 0;
}
