#include <bits/stdc++.h>
using namespace std;
const int NN = 1000100;
int link[NN], fail[NN], len[NN], dif[NN], nxt[NN][26];
int ed, sz, cur;
char s[NN], S[NN], T[NN];
int tp[NN], dp[NN], pre[NN], pr[NN];
void clear(int u, int L = 0) { len[u] = L; }
void init() {
  sz = 2;
  ed = 1;
  cur = 0;
  s[cur] = -1;
  clear(0);
  clear(1, -1);
  fail[0] = 1;
}
inline int get_fail(int u) {
  while (s[cur - len[u] - 1] != s[cur]) u = fail[u];
  return u;
}
int insert(char c) {
  s[++cur] = c -= 'a';
  ed = get_fail(ed);
  if (!nxt[ed][c]) {
    int p1 = sz++;
    clear(p1, len[ed] + 2);
    fail[p1] = nxt[get_fail(fail[ed])][c];
    nxt[ed][c] = p1;
    dif[p1] = len[p1] - len[fail[p1]];
    if (dif[p1] == dif[fail[p1]])
      link[p1] = link[fail[p1]];
    else
      link[p1] = fail[p1];
  }
  ed = nxt[ed][c];
  return ed;
}
int main() {
  scanf("%s%s", S, T);
  int n = strlen(S);
  init();
  memset(tp, 0x3f, sizeof tp);
  for (int i = 1, now; i <= n * 2; i++) {
    if (i & 1)
      now = insert(S[i - 1 >> 1]);
    else
      now = insert(T[i - 1 >> 1]);
    dp[i] = 0x3f3f3f3f;
    if ((~i & 1) && S[i - 1 >> 1] == T[i - 1 >> 1]) {
      dp[i] = dp[i - 2];
      pre[i] = i - 2;
    }
    for (int u = now; u; u = link[u]) {
      pr[u] = i - len[link[u]] - dif[u];
      tp[u] = dp[pr[u]];
      if (link[u] ^ fail[u]) {
        if (tp[u] > tp[fail[u]]) {
          tp[u] = tp[fail[u]];
          pr[u] = pr[fail[u]];
        }
      }
      if (~i & 1) {
        if (dp[i] > tp[u] + 1) {
          dp[i] = tp[u] + 1;
          pre[i] = pr[u];
        }
      }
    }
  }
  if (dp[n * 2] == 0x3f3f3f3f) return puts("-1");
  vector<pair<int, int>> ans;
  int now = n * 2;
  while (now) {
    int pre = ::pre[now];
    if (now - pre > 2) ans.emplace_back((pre >> 1) + 1, now >> 1);
    now = pre;
  }
  cout << ans.size() << endl;
  for (auto &a : ans) printf("%d %d\n", a.first, a.second);
  return 0;
}
