#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n;
struct Node {
  int v, fr;
} dp[N], g[N];
inline bool operator<(const Node &a, const Node &b) {
  return a.v == b.v ? a.fr < b.fr : a.v < b.v;
}
struct Data {
  int s, d, sz;
  inline int v() { return s + d * (sz - 1); }
} se[2][505];
int tp[2];
int al[N], ar[N], atp;
void ins1(Data *b, int &hd, int s) {
  if (!hd) {
    b[++hd] = {s, INT_MAX >> 1, 1};
  } else {
    int del = s - b[hd].v();
    if (del == b[hd].d)
      ++b[hd].sz;
    else
      b[++hd] = {s, del, 1};
  }
}
void ins2(Data *b, int &hd, const Data &p) {
  if (b[hd].d == p.d)
    b[hd].sz += p.sz;
  else
    b[++hd] = p;
}
char ss[N], ss1[N / 2], ss2[N / 2];
void trs(Data *a, int tp, Data *b, int &hd, char c) {
  hd = 0;
  for (int i = 1; i <= tp; i++)
    if (ss[a[i].s - 1] == c) {
      ins1(b, hd, a[i].s - 1);
      if (a[i].sz != 1) ins2(b, hd, {a[i].s + a[i].d - 1, a[i].d, a[i].sz - 1});
    }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> (ss1 + 1) >> (ss2 + 1);
  n = strlen(ss1 + 1);
  for (int i = 1; i <= n; i++) ss[i << 1] = ss1[i];
  for (int i = 1; i <= n; i++) ss[i * 2 - 1] = ss2[i];
  n <<= 1;
  ss[0] = '#';
  for (int i = 1; i <= n; i++) g[i] = {INT_MAX >> 1, 0};
  for (int i = 1; i <= n; i++) dp[i] = {INT_MAX >> 1, 0};
  for (int i = 1, p = 1, q = 0; i <= n; i++, p ^= 1, q ^= 1) {
    trs(se[q], tp[q], se[p], tp[p], ss[i]);
    if (ss[i] == ss[i - 1]) ins1(se[p], tp[p], i - 1);
    if (i & 1) continue;
    if (ss[i] == ss[i - 1]) dp[i] = min(dp[i], {dp[i - 2].v, i - 2});
    Data *a = se[p];
    for (int j = 1; j <= tp[p]; j++) {
      Node ret = {INT_MAX >> 1, 0};
      int ed = a[j].v() - 1;
      if (a[j].sz == 1)
        ret = min(Node{dp[ed].v + 1, ed}, ret);
      else {
        ret = min(Node{dp[ed].v + 1, ed}, g[a[j].s - a[j].d]);
      }
      if (a[j].s - a[j].d >= 0) g[a[j].s - a[j].d] = ret;
      dp[i] = min(dp[i], ret);
    }
  }
  if (dp[n].v == INT_MAX >> 1) {
    cout << -1 << endl;
    return 0;
  }
  for (int p = n; p > 0; p = dp[p].fr)
    if (dp[p].fr < p - 2) {
      al[++atp] = dp[p].fr + 1;
      ar[atp] = p;
    }
  cout << atp << endl;
  for (int i = 1; i <= atp; i++)
    cout << (al[i] + 1) / 2 << ' ' << (ar[i] + 1) / 2 << endl;
  return 0;
}
