#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &res) {
  res = 0;
  T f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    res = res * 10 + c - '0';
    c = getchar();
  }
  res *= f;
}
template <class T>
void out(T x) {
  if (x < 0) {
    putchar('-');
  }
  if (x >= 10) out(x / 10);
  putchar('0' + x % 10);
}
const int inf = 1000000000;
char sa[1000005], sb[1000005], s[1000005];
int N, pre[1000005], tot, l[1000005], r[1000005];
pair<int, int> dp[1000005];
void update(pair<int, int> &a, pair<int, int> b) {
  if (a.first > b.first) a = b;
}
void dfs(int x) {
  if (!x) return;
  int p = dp[x].second;
  if (x - p != 2) l[++tot] = p / 2 + 1, r[tot] = x / 2;
  dfs(p);
}
struct PAM {
  struct node {
    int par, len, nxt[26], spar, diff;
    pair<int, int> sans;
  } tr[1000005];
  int tail, last;
  void Init() {
    tail = 1;
    tr[0].par = 1;
    tr[0].len = 0;
    tr[0].sans = make_pair(inf, -1);
    tr[0].spar = 1;
    tr[1].par = -1;
    tr[1].len = -1;
    tr[1].sans = make_pair(inf, -1);
    tr[1].spar = -1;
  }
  void build(int l) {
    int t = last;
    while (s[l] != s[l - tr[t].len - 1]) t = tr[t].par;
    if (!tr[t].nxt[s[l] - 'a']) {
      int nw = ++tail;
      tr[t].nxt[s[l] - 'a'] = nw;
      tr[nw].len = tr[t].len + 2;
      if (t == 1)
        tr[nw].par = 0;
      else {
        int x = tr[t].par;
        while (s[l] != s[l - tr[x].len - 1]) x = tr[x].par;
        tr[nw].par = tr[x].nxt[s[l] - 'a'];
      }
      tr[nw].diff = tr[nw].len - tr[tr[nw].par].len;
      if (tr[nw].diff == tr[tr[nw].par].diff)
        tr[nw].spar = tr[tr[nw].par].spar;
      else
        tr[nw].spar = tr[nw].par;
      tr[nw].sans = make_pair(inf, 0);
    }
    last = tr[t].nxt[s[l] - 'a'];
    for (int v = last; v >= 2; v = tr[v].spar) {
      int p = l - tr[tr[v].spar].len - tr[v].diff;
      tr[v].sans = make_pair(dp[p].first, p);
      if (tr[v].diff == tr[tr[v].par].diff)
        update(tr[v].sans, tr[tr[v].par].sans);
      pair<int, int> t = tr[v].sans;
      t.first++;
      if (l % 2 == 0) update(dp[l], t);
    }
  }
} pam;
void Solve() {
  scanf("%s", sa + 1);
  scanf("%s", sb + 1);
  N = strlen(sa + 1);
  for (int i = 1; i <= N; ++i) {
    s[i * 2 - 1] = sa[i];
    s[i * 2] = sb[i];
    dp[i * 2 - 1] = make_pair(inf, 0), dp[i * 2] = make_pair(inf, 0);
  }
  pam.Init();
  for (int i = 1; i <= 2 * N; ++i) {
    if (i % 2 == 0 && s[i] == s[i - 1]) {
      dp[i] = make_pair(dp[i - 2].first, i - 2);
    }
    pam.build(i);
  }
  if (dp[2 * N].first > N) {
    puts("-1");
  } else {
    dfs(2 * N);
    out(tot);
    putchar('\n');
    for (int i = 1; i <= tot; ++i) {
      out(l[i]);
      putchar(' ');
      out(r[i]);
      putchar('\n');
    }
  }
}
int main() { Solve(); }
