#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10, oo = 1e9;
char s[maxn], t[maxn];
int n, f[maxn], g[maxn], m, len[maxn], par[maxn], anc[maxn], remf[maxn],
    remg[maxn], go[maxn][26];
int main() {
  scanf("%s", t);
  n = strlen(t);
  for (int i = 0; i < n; ++i) s[(i << 1) | 1] = t[i];
  scanf("%s", t);
  for (int i = 0; i < n; ++i) s[i + 1 << 1] = t[i];
  n <<= 1;
  len[0] = -(m = 1);
  remf[0] = remf[1] = oo;
  anc[0] = 0;
  anc[1] = 1;
  for (int lst = 0, i = 1; i <= n; ++i) {
    f[i] = oo;
    while (s[i - len[lst] - 1] != s[i]) lst = par[lst];
    if (!go[lst][s[i] - 'a']) {
      go[lst][s[i] - 'a'] = ++m;
      len[m] = len[lst] + 2;
      if (!lst)
        par[m] = 1;
      else {
        int x = par[lst];
        while (s[i - len[x] - 1] != s[i]) x = par[x];
        par[m] = go[x][s[i] - 'a'];
      }
      anc[m] = ((par[m] > 1 &&
                 len[m] - len[par[m]] == len[par[m]] - len[par[par[m]]])
                    ? anc[par[m]]
                    : m);
    }
    lst = go[lst][s[i] - 'a'];
    for (int u = lst; u > 1; u = par[anc[u]]) {
      remf[u] = f[i - len[anc[u]]];
      remg[u] = i - len[anc[u]];
      if (anc[u] != u && remf[par[u]] < remf[u])
        remf[u] = remf[par[u]], remg[u] = remg[par[u]];
      if ((~i & 1) && f[i] > remf[u] + 1) f[i] = remf[u] + 1, g[i] = remg[u];
    }
    if ((~i & 1) && s[i - 1] == s[i] && f[i - 2] < f[i])
      f[i] = f[i - 2], g[i] = i - 2;
  }
  if (f[n] == oo) {
    puts("-1");
    return 0;
  }
  printf("%d\n", f[n]);
  for (int i = n; i; i = g[i]) {
    if (i - g[i] > 2) printf("%d %d\n", (g[i] >> 1) + 1, i >> 1);
  }
  return 0;
}
