#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int mark[maxn], pre[maxn], g[maxn], f[maxn], top[maxn], d[maxn], len[maxn],
    fail[maxn], go[maxn][26], tot, lst;
char t[maxn], tt[maxn], s[maxn];
void build() {
  s[0] = -1;
  len[tot = 1] = -1;
  len[0] = 0;
  fail[1] = fail[0] = 1;
}
int ins(int n, int c) {
  int p = lst;
  while (s[n - len[p] - 1] != s[n]) p = fail[p];
  if (!go[p][c]) {
    int v = ++tot, k = fail[p];
    len[v] = len[p] + 2;
    while (s[n - len[k] - 1] != s[n]) k = fail[k];
    fail[v] = go[k][c];
    d[v] = len[v] - len[fail[v]];
    top[v] = d[v] == d[fail[v]] ? top[fail[v]] : fail[v];
    go[p][c] = v;
  }
  return lst = go[p][c];
}
int main() {
  memset(f, 0x3f, sizeof(f));
  f[0] = 0;
  scanf("%s%s", t + 1, tt + 1);
  int Len = strlen(t + 1);
  for (int i = 1; i <= Len; i++) s[2 * i - 1] = t[i], s[2 * i] = tt[i];
  Len <<= 1;
  build();
  for (int i = 1; i <= Len; i++) {
    ins(i, s[i] - 'a');
    for (int j = lst; j > 1; j = top[j]) {
      g[j] = i - len[top[j]] - d[j];
      if (d[j] == d[fail[j]]) {
        if (f[g[j]] > f[g[fail[j]]]) {
          g[j] = g[fail[j]];
        }
      }
      if (i % 2 == 0) {
        if (f[g[j]] + 1 < f[i]) {
          f[i] = f[g[j]] + 1;
          pre[i] = g[j];
          mark[i] = 1;
        }
      }
    }
    if (i % 2 == 0) {
      if (s[i] == s[i - 1] && f[i - 2] < f[i]) {
        f[i] = f[i - 2];
        pre[i] = i - 2;
        mark[i] = 0;
      }
    }
  }
  if (f[Len] >= 0x3f3f3f3f) {
    puts("-1");
    return 0;
  }
  printf("%d\n", f[Len]);
  for (int i = Len; i; i = pre[i]) {
    if (mark[i]) printf("%d %d\n", pre[i] / 2 + 1, i / 2);
  }
  return 0;
}
