#include <bits/stdc++.h>
using namespace std;
const int maxn = int(5e5) + 100;
const int inf = 0x3fffffff;
int n, m;
int total;
char st[maxn], str[maxn];
int son[maxn * 2][26];
int len[maxn * 2], a[maxn * 2], S[maxn * 2], fail[maxn * 2], diff[maxn * 2],
    anc[maxn * 2];
int hd[maxn * 2], ans[maxn * 2], path[maxn * 2];
int last;
void read() {
  gets(st);
  gets(str);
  int len = strlen(st);
  for (int i = 0; i < len; ++i) {
    a[++n] = st[i] - 'a';
    a[++n] = str[i] - 'a';
  }
}
void init() {
  S[0] = -1;
  m = 0;
  total = 1;
  last = 0;
  len[0] = 0;
  len[1] = -1;
  fail[0] = 1;
  fail[1] = 0;
}
void insert(int ch) {
  S[++m] = ch;
  int cur = last;
  while (S[m - len[cur] - 1] != S[m]) cur = fail[cur];
  if (!son[cur][ch]) {
    len[++total] = len[cur] + 2;
    int tmp = fail[cur];
    while (S[m - len[tmp] - 1] != S[m]) tmp = fail[tmp];
    tmp = son[tmp][ch];
    fail[total] = tmp;
    son[cur][ch] = total;
    diff[total] = len[total] - len[tmp];
    anc[total] = (diff[total] == diff[tmp] ? anc[tmp] : tmp);
  }
  last = son[cur][ch];
}
void solve() {
  init();
  for (int i = 1; i <= n; ++i) ans[i] = inf;
  for (int i = 1; i <= n; ++i) {
    insert(a[i]);
    for (int j = last; j; j = anc[j]) {
      hd[j] = i - len[anc[j]] - diff[j];
      if (anc[j] != fail[j] && ans[hd[fail[j]]] < ans[hd[j]])
        hd[j] = hd[fail[j]];
      if (!(i & 1) && ans[hd[j]] + 1 < ans[i]) {
        ans[i] = ans[hd[j]] + 1;
        path[i] = hd[j];
      }
    }
    if (!(i & 1) && a[i] == a[i - 1] && ans[i - 2] < ans[i]) {
      ans[i] = ans[i - 2];
      path[i] = i - 2;
    }
  }
  if (ans[n] < inf) {
    printf("%d\n", ans[n]);
    for (int i = n; i; i = path[i])
      if (path[i] + 2 < i) printf("%d %d\n", path[i] / 2 + 1, i / 2);
  } else
    printf("-1\n");
}
int main() {
  read();
  solve();
  return 0;
}
