#include <bits/stdc++.h>
using namespace std;
template <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(long long &x) { scanf("%lld", &x); }
void _R(unsigned long long &x) { scanf("%llu", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const long long &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
void _W(const unsigned long long &x) { printf("%llu", x); }
template <class T, class U>
void _W(const pair<T, U> &x) {
  _W(x.first);
  putchar(' ');
  _W(x.second);
}
template <class T>
void _W(const vector<T> &x) {
  for (auto i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &...tail) {
  _W(head);
  putchar(sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
const int MOD = 1e9 + 7, mod = 998244353;
long long qpow(long long a, long long b) {
  long long res = 1;
  a %= MOD;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
  }
  return res;
}
const int MAXN = 1e6 + 10, MAXM = 2e6 + 10;
const int INF = INT_MAX, SINF = 0x3f3f3f3f;
const long long llINF = LLONG_MAX, SLINF = 0x3f3f3f3f3f3f3f3fLL;
const int inv2 = (MOD + 1) / 2;
const int Lim = 1 << 20;
struct PAM {
  int sz, tot, last;
  int ch[MAXN][26], len[MAXN], fail[MAXN];
  int cnt[MAXN], dep[MAXN], dif[MAXN], slink[MAXN];
  char s[MAXN];
  int newnode(int l) {
    sz++;
    memset(ch[sz], 0, sizeof(ch[sz]));
    len[sz] = l;
    fail[sz] = cnt[sz] = dep[sz] = 0;
    return sz;
  }
  void init() {
    sz = -1;
    last = 0;
    s[tot = 0] = '$';
    newnode(0);
    newnode(-1);
    fail[0] = 1;
  }
  int getfail(int x) {
    while (s[tot - len[x] - 1] != s[tot]) x = fail[x];
    return x;
  }
  void insert(char c) {
    s[++tot] = c;
    int now = getfail(last);
    if (!ch[now][c - 'a']) {
      int x = newnode(len[now] + 2);
      fail[x] = ch[getfail(fail[now])][c - 'a'];
      dep[x] = dep[fail[x]] + 1;
      ch[now][c - 'a'] = x;
      dif[x] = len[x] - len[fail[x]];
      if (dif[x] == dif[fail[x]])
        slink[x] = slink[fail[x]];
      else
        slink[x] = fail[x];
    }
    last = ch[now][c - 'a'];
    cnt[last]++;
  }
} pam;
int g[MAXN], dp[MAXN], pre[MAXN], preg[MAXN];
char s[MAXN], t[MAXN], ss[MAXN];
void solve() {
  pam.init();
  R(s, t);
  int n = strlen(s);
  for (int i = 0; i < n; i++) ss[i * 2 + 1] = s[i], ss[i * 2 + 2] = t[i];
  n *= 2;
  memset(dp, 0x3f, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= n; i++) {
    pam.insert(ss[i]);
    for (int x = pam.last; x > 1; x = pam.slink[x]) {
      g[x] = dp[i - pam.len[pam.slink[x]] - pam.dif[x]];
      preg[x] = i - pam.len[pam.slink[x]] - pam.dif[x];
      if (pam.dif[x] == pam.dif[pam.fail[x]] && g[x] > g[pam.fail[x]]) {
        g[x] = g[pam.fail[x]];
        preg[x] = preg[pam.fail[x]];
      }
      if (i % 2 == 0 && g[x] + 1 < dp[i]) {
        dp[i] = g[x] + 1;
        pre[i] = preg[x];
      }
    }
    if (ss[i] == ss[i - 1] && dp[i] > dp[i - 2]) {
      dp[i] = dp[i - 2];
      pre[i] = i - 2;
    }
  }
  if (dp[n] >= dp[n + 1]) return W(-1);
  W(dp[n]);
  while (n / 2) {
    if (n - pre[n] > 2) W(pre[n] / 2 + 1, n / 2);
    n = pre[n];
  }
}
int main() {
  srand(time(0));
  int T = 1;
  while (T--) solve();
  return 0;
}
