#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void init(T& x) {
  x = 0;
  char ch = getchar();
  bool t = 0;
  for (; ch > '9' || ch < '0'; ch = getchar())
    if (ch == '-') t = 1;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 1) + (x << 3) + (ch - 48);
  if (t) x = -x;
  return;
}
const int N = 5e5 + 10;
char S[2][N];
namespace PAM {
const int MAXN = N << 1, INF = 1e9;
int son[MAXN][26], len[MAXN], fa[MAXN], dif[MAXN], anc[MAXN];
int lst, now;
char MS[N << 1];
int LS = 0, cnt = 0, pos[MAXN];
inline void Clear() {
  while (~cnt) {
    len[cnt] = fa[cnt] = 0;
    memset(son[cnt], 0, sizeof(son[cnt]));
    pos[cnt] = -1;
    --cnt;
  }
  lst = now = LS = 0;
  fa[1] = -1, fa[0] = 1, len[1] = -1, len[0] = 0;
  cnt = 1;
}
int dp[N << 1], Pre[N << 1];
struct Ans {
  int l, r;
  Ans() { l = 0, r = 0; }
  Ans(int _l, int _r) { l = _l, r = _r; }
};
Ans ans[N];
int cur = 0;
inline bool check(int l, int r) {
  for (int i = l + 1; i <= r; ++i)
    if (S[0][i] != S[1][i]) return 1;
  return 0;
}
inline int Find(int u) {
  while (~u && MS[now] != MS[now - len[u] - 1]) u = fa[u];
  return u;
}
inline void Extend(int c) {
  int u = Find(lst);
  if (!son[u][c]) {
    son[u][c] = ++cnt, fa[cnt] = son[Find(fa[u])][c], len[cnt] = len[u] + 2;
    dif[cnt] = len[cnt] - len[fa[cnt]];
    if (dif[cnt] == dif[fa[cnt]])
      anc[cnt] = anc[fa[cnt]];
    else
      anc[cnt] = fa[cnt];
  }
  lst = son[u][c];
}
inline void work() {
  Clear();
  int l1 = strlen(S[0] + 1), l2 = strlen(S[1] + 1);
  int i, j;
  for (LS = 1, i = 0, j = 0; i < l1 || j < l2; ++LS) {
    if (LS & 1)
      MS[LS] = S[0][++i];
    else
      MS[LS] = S[1][++j];
  }
  --LS;
  pos[0] = 0;
  for (dp[0] = 0, now = 1; now <= LS; ++now) {
    dp[now] = INF;
    Extend(MS[now] - 'a');
    Pre[now] = 0;
    for (int u = lst; u > 1; u = anc[u]) {
      int j = now - len[anc[u]] - dif[u];
      pos[u] = j;
      if (fa[u] != anc[u] && dp[pos[u]] > dp[pos[fa[u]]]) pos[u] = pos[fa[u]];
      if (!((now)&1) && dp[now] > dp[pos[u]] + 1)
        dp[now] = dp[pos[u]] + 1, Pre[now] = pos[u];
    }
    if (!((now)&1) && MS[now] == MS[now - 1]) {
      if (dp[now - 2] < dp[now]) {
        dp[now] = dp[now - 2];
        Pre[now] = now - 2;
      }
    }
  }
  now = LS;
  cur = 0;
  if (dp[LS] == INF) {
    puts("-1");
    return;
  }
  while (now) {
    int nxt = Pre[now];
    if (check(nxt >> 1, now >> 1)) ans[++cur] = Ans((nxt >> 1) + 1, now >> 1);
    now = nxt;
  }
  printf("%d\n", cur);
  for (int i = 1; i <= cur; ++i) printf("%d %d\n", ans[i].l, ans[i].r);
}
}  // namespace PAM
int main() {
  scanf("%s", S[0] + 1);
  scanf("%s", S[1] + 1);
  PAM::work();
  return 0;
}
