#include <bits/stdc++.h>
clock_t t = clock();
namespace my_std {
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline T rnd(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
template <typename T>
inline bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline void read(T &t) {
  t = 0;
  char f = 0, ch = getchar();
  double d = 0.1;
  while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
  while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
  if (ch == '.') {
    ch = getchar();
    while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
  }
  t = (f ? -t : t);
}
template <typename T, typename... Args>
inline void read(T &t, Args &...args) {
  read(t);
  read(args...);
}
char __sr[1 << 21], __z[20];
int __C = -1, __zz = 0;
inline void Ot() { fwrite(__sr, 1, __C + 1, stdout), __C = -1; }
inline void print(register int x) {
  if (__C > 1 << 20) Ot();
  if (x < 0) __sr[++__C] = '-', x = -x;
  while (__z[++__zz] = x % 10 + 48, x /= 10)
    ;
  while (__sr[++__C] = __z[__zz], --__zz)
    ;
  __sr[++__C] = '\n';
}
void file() {}
inline void chktime() {}
long long ksm(long long x, int y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x)
    if (y & 1) ret = ret * x;
  return ret;
}
}  // namespace my_std
using namespace my_std;
int n;
char a[1010101], b[1010101], s[1010101];
struct hh {
  int fr, w;
  hh(int F = 0, int W = 1e9) { fr = F, w = W; }
  const bool operator<(const hh &x) const { return w < x.w; }
} dp[1010101], g[1010101];
struct hhh {
  int s, delta, size;
  int ed() { return s + (size - 1) * delta; }
} P[2][1010101];
int C[2];
void ins1(hhh *a, int &n, int p) {
  if (!n)
    a[++n] = (hhh){p, (int)1e9, 1};
  else if (p - a[n].ed() == a[n].delta)
    ++a[n].size;
  else
    a[n + 1] = (hhh){p, p - a[n].ed(), 1}, ++n;
}
void ins2(hhh *a, int &n, hhh x) {
  if (a[n].delta == x.delta)
    a[n].size += x.size;
  else
    a[++n] = x;
}
void Trans(hhh *a, int n, hhh *b, int &m, char c) {
  m = 0;
  for (int i = (1); i <= (n); i++)
    if (s[a[i].s - 1] == c) {
      ins1(b, m, a[i].s - 1);
      if (a[i].size > 1)
        ins2(b, m, (hhh){a[i].s + a[i].delta - 1, a[i].delta, a[i].size - 1});
    }
}
int main() {
  file();
  cin >> (a + 1) >> (b + 1);
  n = strlen(a + 1);
  for (int i = (1); i <= (n); i++) s[i * 2 - 1] = a[i];
  for (int i = (1); i <= (n); i++) s[i * 2] = b[i];
  dp[0] = hh(0, 0);
  for (int i = 1, p = 0, q = 1; i <= n * 2; i++, p ^= 1, q ^= 1) {
    Trans(P[p], C[p], P[q], C[q], s[i]);
    if (i != 1 && s[i] == s[i - 1]) ins1(P[q], C[q], i - 1);
    if (i & 1) continue;
    if (s[i] == s[i - 1]) dp[i] = (hh){i - 2, dp[i - 2].w};
    for (int j = (1); j <= (C[q]); j++) {
      hhh cur = P[q][j];
      hh ret;
      if (cur.size == 1)
        ret = (hh){cur.s - 1, dp[cur.s - 1].w + 1};
      else
        ret = min(g[cur.s - cur.delta],
                  (hh){cur.delta * (cur.size - 1) + cur.s - 1,
                       dp[cur.delta * (cur.size - 1) + cur.s - 1].w + 1});
      dp[i] = min(dp[i], ret);
      int pos = cur.s - cur.delta;
      if (pos >= 0) g[pos] = ret;
    }
  }
  if (dp[n * 2].w > n) return puts("-1"), 0;
  cout << dp[n * 2].w << '\n';
  for (int i = n * 2; i; i = dp[i].fr)
    if (dp[i].fr != i - 2 || s[i - 1] != s[i])
      printf("%d %d\n", (dp[i].fr >> 1) + 1, i >> 1);
  return 0;
}
