#include <bits/stdc++.h>
using namespace std;
const int inf = 987654321;
template <typename T>
inline void MIN(T &a, T b) {
  if (b < a) a = b;
}
char s[1001000], ss[1001000];
int fail[1001000], son[1001000][26], len[1001000], tot, lst, diff[1001000],
    slink[1001000];
pair<int, int> f[1001000], g[1001000];
inline void init() {
  fail[0] = fail[1] = tot = 1;
  len[1] = -1;
}
inline void ins(int pos) {
  int p = lst, c = s[pos] - 'a';
  while (s[pos] != s[pos - len[p] - 1]) p = fail[p];
  if (son[p][c]) return lst = son[p][c], void();
  int x = fail[p];
  while (s[pos] != s[pos - len[x] - 1]) x = fail[x];
  int np = ++tot;
  lst = np;
  fail[np] = x = son[x][c];
  len[np] = len[p] + 2;
  son[p][c] = np;
  diff[np] = len[np] - len[x];
  slink[np] = diff[np] == diff[x] ? slink[x] : x;
}
int main() {
  scanf("%s", s + 1);
  scanf("%s", ss + 1);
  int n = strlen(s + 1);
  for (int i = n; i; --i) s[i + i] = ss[i], s[i + i - 1] = s[i];
  n <<= 1;
  init();
  f[0] = make_pair(0, 0);
  for (int i = 1; i <= n; ++i) {
    if (s[i] == s[i - 1])
      f[i] = make_pair(f[i - 2].first, i - 2);
    else
      f[i] = make_pair(inf, 0);
    ins(i);
    for (int p = lst; p; p = slink[p]) {
      g[p] = make_pair(f[i - diff[p] - len[slink[p]]].first,
                       i - diff[p] - len[slink[p]]);
      if (slink[p] != fail[p]) MIN(g[p], g[fail[p]]);
      if (!(i & 1)) MIN(f[i], make_pair(g[p].first + 1, g[p].second));
    }
  }
  if (f[n].first > 1001000) {
    puts("-1");
    return 0;
  }
  printf("%d\n", f[n].first);
  int nw = n;
  while (nw) {
    int to = f[nw].second;
    if (nw - to != 2) printf("%d %d\n", (to >> 1) + 1, nw >> 1);
    nw = to;
  }
  return 0;
}
