#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
char s[maxn], s1[maxn], s2[maxn];
int nxt[maxn][26], fail[maxn], len[maxn], dt[maxn], st[maxn];
int g[maxn], f[maxn], pf[maxn];
int n, cnt, cur, last;
int add(int l) {
  ++cnt;
  memset(nxt[cnt], 0, sizeof nxt[cnt]);
  len[cnt] = l, fail[cnt] = 0;
  return cnt;
}
void init() {
  cnt = -1, add(0), add(-1);
  s[0] = '@', cur = last = fail[0] = 1;
}
int getf(int x) {
  while (s[cur] != s[cur - len[x] - 1]) x = fail[x];
  return x;
}
void insert(char ch) {
  s[cur] = ch;
  int t = ch - 'a', p = getf(last);
  if (!nxt[p][t]) {
    int q = add(len[p] + 2);
    fail[q] = nxt[getf(fail[p])][t];
    dt[q] = len[q] - len[fail[q]];
    st[q] = dt[q] == dt[fail[q]] ? st[fail[q]] : fail[q];
    nxt[p][t] = q;
  }
  last = nxt[p][t], ++cur;
}
void solve() {
  init();
  f[0] = 0;
  for (int i = 1; i <= n; ++i) {
    insert(s[i]), f[i] = inf;
    for (int j = last; j; j = st[j]) {
      g[j] = i - len[st[j]] - dt[j];
      if (st[j] != fail[j] && f[g[fail[j]]] < f[g[j]]) g[j] = g[fail[j]];
      if ((~i & 1) && f[i] > f[g[j]] + 1) f[i] = f[g[j]] + 1, pf[i] = g[j];
    }
    if ((~i & 1) && s[i] == s[i - 1] && f[i] > f[i - 2])
      f[i] = f[i - 2], pf[i] = i - 2;
  }
  if (f[n] == inf) {
    cout << "-1\n";
    return;
  }
  cout << f[n] << "\n";
  for (int i = n; i >= 1; i = pf[i]) {
    if (i - pf[i] != 2) cout << pf[i] / 2 + 1 << " " << i / 2 << "\n";
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> s1 + 1 >> s2 + 1;
  n = strlen(s1 + 1);
  for (int i = 1; i <= n; ++i) {
    s[i * 2 - 1] = s1[i];
    s[i * 2] = s2[i];
  }
  n <<= 1;
  solve();
  return 0;
}
