#include <bits/stdc++.h>
using namespace std;
const int N = 1000050;
char a[N], b[N], s[N];
int tr[N][26], l[N], fa[N], f[N], ans[N], fr[N], anc[N], dif[N], tot = 1, las;
void add(int c, int n) {
  int v = las;
  while (s[n - l[v] - 1] != s[n]) v = fa[v];
  if (!tr[v][c]) {
    int u = fa[v], p = ++tot;
    l[p] = l[v] + 2;
    while (s[n - l[u] - 1] != s[n]) u = fa[u];
    fa[p] = tr[u][c], tr[v][c] = p;
    dif[p] = l[p] - l[fa[p]],
    anc[p] = dif[p] == dif[fa[p]] ? anc[fa[p]] : fa[p];
  }
  las = tr[v][c];
  return;
}
int main() {
  scanf("%s%s", a + 1, b + 1);
  int n = strlen(a + 1);
  for (int i = 1; i <= n; ++i) s[i * 2 - 1] = a[i], s[i * 2] = b[i];
  n <<= 1, s[0] = 'a' - 1, s[n + 1] = 'a' - 2;
  memset(ans, 100, sizeof(ans));
  fa[0] = 1, l[1] = -1, ans[0] = 0;
  for (int i = 1; i <= n; ++i) {
    add(s[i] - 'a', i);
    for (int k = las; k; k = anc[k]) {
      f[k] = i - l[anc[k]] - dif[k];
      if (anc[k] != fa[k] && ans[f[fa[k]]] < ans[f[k]]) f[k] = f[fa[k]];
      if (!(i & 1) && ans[i] > ans[f[k]] + 1)
        fr[i] = f[k], ans[i] = ans[f[k]] + 1;
    }
    if (s[i] == s[i - 1] && ans[i - 2] < ans[i])
      ans[i] = ans[i - 2], fr[i] = i - 2;
  }
  if (ans[n] <= n) {
    cout << ans[n] << endl;
    for (int i = n; i >= 1;) {
      if (fr[i] + 2 < i)
        printf("%d %d\n", fr[i] / 2 + 1, i / 2), i = fr[i];
      else
        i -= 2;
    }
  } else
    puts("-1");
  return 0;
}
