#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
char s1[N], s2[N], s[N];
int n, lst, nod, len[N], fail[N], diff[N], anc[N], ch[N][26];
int f[N], pos[N], pre[N];
void init() {
  fail[0] = fail[1] = nod = 1;
  len[1] = -1;
}
void extend(int c, int i) {
  int p = lst;
  while (s[i - len[p] - 1] != s[i]) p = fail[p];
  if (!ch[p][c]) {
    int x = ++nod, k = fail[p];
    while (s[i - len[k] - 1] != s[i]) k = fail[k];
    fail[x] = ch[k][c];
    ch[p][c] = x;
    len[x] = len[p] + 2;
    diff[x] = len[x] - len[fail[x]];
    anc[x] = (diff[x] == diff[fail[x]]) ? anc[fail[x]] : fail[x];
  }
  lst = ch[p][c];
}
int main() {
  scanf("%s%s", s1 + 1, s2 + 1);
  n = strlen(s1 + 1);
  init();
  for (int i = 1; i <= n * 2; i++) s[i] = (i & 1) ? s1[(i + 1) / 2] : s2[i / 2];
  for (int i = 1; i <= n * 2; i++) f[i] = 1e9;
  for (int i = 1; i <= n * 2; i++) {
    extend(s[i] - 'a', i);
    for (int k = lst; k; k = anc[k]) {
      pos[k] = i - len[anc[k]] - diff[k];
      if (anc[k] != fail[k] && f[pos[fail[k]]] < f[pos[k]])
        pos[k] = pos[fail[k]];
      if (!(i & 1) && f[i] > f[pos[k]] + 1)
        f[i] = f[pos[k]] + 1, pre[i] = pos[k];
    }
    if (!(i & 1) && s[i] == s[i - 1] && f[i - 2] <= f[i])
      f[i] = f[i - 2], pre[i] = i - 2;
  }
  if (f[n * 2] >= 1e9) return puts("-1"), 0;
  printf("%d\n", f[n * 2]);
  for (int i = n * 2; i; i = pre[i])
    if (i - pre[i] > 2) printf("%d %d\n", pre[i] / 2 + 1, i >> 1);
}
