#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int L = 1000010;
const int C = 26;
int n;
char str[L];
pair<int, int> f[L];
inline void applyMin(pair<int, int> &x, pair<int, int> y) {
  if (y < x) x = y;
}
namespace PAM {
int str[L], pos;
int sz, cur;
int trans[L][C];
int len[L];
int fail[L];
int diff[L], slink[L];
pair<int, int> g[L][2];
void init() {
  str[pos = 0] = -1;
  sz = 1;
  cur = 0;
  len[0] = 0;
  len[1] = -1;
  fail[0] = 1;
  g[0][0] = make_pair(0, 0);
  g[0][1] = make_pair(INF, -1);
}
int getFail(int u) {
  while (str[pos - len[u] - 1] != str[pos]) u = fail[u];
  return u;
}
void insert(int c) {
  str[++pos] = c;
  int u = getFail(cur);
  if (!trans[u][c]) {
    int v = ++sz;
    len[v] = len[u] + 2;
    fail[v] = trans[getFail(fail[u])][c];
    trans[u][c] = v;
  }
  cur = trans[u][c];
  diff[cur] = len[cur] - len[fail[cur]];
  if (fail[cur] <= 1)
    slink[cur] = fail[cur];
  else
    slink[cur] = (diff[cur] == diff[fail[cur]]) ? slink[fail[cur]] : fail[cur];
  for (u = cur; len[u] > 0; u = slink[u]) {
    g[u][0] = g[u][1] = make_pair(INF, -1);
    g[u][(len[slink[u]] + diff[u]) & 1] =
        make_pair(f[pos - (len[slink[u]] + diff[u])].first,
                  pos - (len[slink[u]] + diff[u]));
    if (diff[u] == diff[fail[u]]) {
      applyMin(g[u][diff[u] & 1], g[fail[u]][0]);
      applyMin(g[u][diff[u] & 1 ^ 1], g[fail[u]][1]);
    }
    applyMin(f[pos], make_pair(g[u][0].first + 1, g[u][0].second));
  }
}
}  // namespace PAM
void readData() {
  static char s[L], t[L];
  scanf("%s%s", s + 1, t + 1);
  int m = strlen(s + 1);
  n = m * 2;
  for (int i = 1; i <= m; i++) {
    str[(i << 1) - 1] = s[i];
    str[(i << 1)] = t[i];
  }
}
void dp() {
  PAM::init();
  f[0] = make_pair(0, 0);
  for (int i = 1; i <= n; i++) {
    f[i] = make_pair(INF, -1);
    PAM::insert(str[i] - 'a');
    if (i > 1 && str[i] == str[i - 1])
      applyMin(f[i], make_pair(f[i - 2].first, i - 2));
  }
  if (f[n].first == INF) {
    puts("-1");
    return;
  }
  printf("%d\n", f[n].first);
  for (int i = n; i; i = f[i].second) {
    int l = f[i].second, r = i;
    if (r - l > 2) printf("%d %d\n", (l >> 1) + 1, r >> 1);
  }
}
int main() {
  readData();
  dp();
  return 0;
}
