#include <bits/stdc++.h>
using namespace std;
inline int gi() {
  register int data = 0, fu = 1;
  register char ch = getchar();
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') fu = -1, ch = getchar();
  while ('0' <= ch && ch <= '9')
    data = (data << 1) + (data << 3) + (ch ^ 48), ch = getchar();
  return fu * data;
}
const int inf = 1000000007;
int f[1000005], g[1000005], h[1000005], pre[1000005], ch[1000005][27],
    fail[1000005], len[1000005], delta[1000005], top[1000005];
int n, m;
char s1[1000005], s2[1000005], s[1000005];
int oo, last;
inline void Init() {
  for (int i = 0; i <= oo; i++) memset(ch[i], 0, sizeof(ch[i])), fail[i] = 0;
  oo = 1;
  g[0] = g[1] = inf;
  delta[0] = delta[1] = inf;
  fail[1] = fail[0] = 1;
  len[0] = 0;
  len[oo] = -1;
  last = 0;
  return;
}
inline void Extend(int ps, int c) {
  int p = last, cl;
  while (s[ps - len[p] - 1] != s[ps]) p = fail[p];
  if (!ch[p][c]) {
    cl = fail[p];
    while (s[ps - len[cl] - 1] != s[ps]) cl = fail[cl];
    ++oo;
    len[oo] = len[p] + 2;
    fail[oo] = ch[cl][c];
    g[oo] = inf;
    ch[p][c] = oo;
  }
  last = ch[p][c];
  delta[last] = len[last] - len[fail[last]];
  top[last] = (delta[last] == delta[fail[last]]) ? top[fail[last]] : last;
  return;
}
inline void Work() {
  scanf("%s", s1 + 1);
  scanf("%s", s2 + 1);
  n = strlen(s1 + 1);
  for (int i = 1; i <= n; i++) s[2 * i - 1] = s1[i], s[2 * i] = s2[i];
  n <<= 1;
  for (int i = 1; i <= n; i++) f[i] = inf;
  f[0] = 0;
  Init();
  for (int i = 1; i <= n; i++) {
    Extend(i, s[i] - 'a');
    int x = last;
    while (x > 1) {
      g[x] = delta[fail[x]] == delta[x] ? g[fail[x]] : inf;
      h[x] = delta[fail[x]] == delta[x] ? h[fail[x]] : inf;
      g[x] = min(g[x], f[i - len[top[x]]] + 1);
      if (g[x] == f[i - len[top[x]]] + 1) h[x] = i - len[top[x]];
      f[i] = min(f[i], g[x]);
      if (f[i] == g[x]) pre[i] = h[x];
      x = fail[top[x]];
    }
    if (i & 1)
      f[i] = inf;
    else if (s[i] == s[i - 1]) {
      f[i] = min(f[i], f[i - 2]);
      if (f[i] == f[i - 2]) pre[i] = -1;
    }
  }
  if (f[n] == inf)
    puts("-1");
  else {
    printf("%d\n", f[n]);
    int x = n;
    while (x) {
      if (pre[x] == -1)
        x -= 2;
      else
        printf("%d %d\n", (pre[x] / 2) + 1, x / 2), x = pre[x];
    }
  }
  return;
}
int main() {
  m = 17;
  Work();
  return 0;
}
