#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& x) {
  int f = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int N = 1000000 + 5;
int n, m, L, sz, last;
int ch[N][26];
int link[N], slink[N], len[N];
int sa[N], sg[N], diff[N];
int f[N], g[N];
char s[N], t[N], S[N];
void PAM_init() {
  S[0] = -1;
  last = 0;
  n = 0, sz = 1;
  len[0] = 0;
  len[1] = -1;
  link[0] = 1;
}
int get_link(int x) {
  while (S[n - len[x] - 1] != S[n]) x = link[x];
  return x;
}
void add(int c) {
  S[++n] = c;
  last = get_link(last);
  if (!ch[last][c]) {
    ++sz;
    len[sz] = len[last] + 2;
    link[sz] = ch[get_link(link[last])][c];
    diff[sz] = len[sz] - len[link[sz]];
    if (diff[sz] == diff[link[sz]])
      slink[sz] = slink[link[sz]];
    else
      slink[sz] = link[sz];
    ch[last][c] = sz;
  }
  last = ch[last][c];
}
void print(int x) {
  if (x == 0) return;
  print(g[x]);
  if (x - g[x] != 2) {
    printf("%d %d\n", (g[x] + 2) / 2, (x + 1) / 2);
  }
}
int main() {
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  L = strlen(s + 1);
  PAM_init();
  f[0] = 0;
  memset(sa, 0x3f, sizeof sa);
  for (int i = 1; i <= 2 * L; i++) {
    if (i & 1)
      add(s[(i - 1) / 2 + 1] - 'a');
    else
      add(t[(i - 1) / 2 + 1] - 'a');
    f[i] = 0x3f3f3f3f;
    for (int v = last; len[v] > 0; v = slink[v]) {
      sa[v] = f[i - (len[slink[v]] + diff[v])];
      sg[v] = i - (len[slink[v]] + diff[v]);
      if (diff[v] == diff[link[v]]) {
        if (sa[v] > sa[link[v]] ||
            (sa[v] == sa[link[v]] && sg[v] < sg[link[v]])) {
          sa[v] = sa[link[v]];
          sg[v] = sg[link[v]];
        }
      }
      if (sa[v] < f[i] || (sa[v] == f[i] && g[i] < sg[v])) {
        f[i] = sa[v];
        g[i] = sg[v];
      }
    }
    f[i]++;
    if (i & 1) f[i] = 0x3f3f3f3f, g[i] = 0x3f3f3f3f;
    if (((i & 1) == 0) && S[n] == S[n - 1] && f[i - 2] < f[i]) {
      f[i] = f[i - 2];
      g[i] = i - 2;
    }
  }
  if (f[2 * L] >= 0x3f3f3f3f) {
    printf("-1\n");
    return 0;
  }
  printf("%d\n", f[2 * L]);
  print(2 * L);
  return 0;
}
