#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;
bool update(int &x, int y) {
  if (x > y) {
    x = y;
    return true;
  } else
    return false;
}
struct Palindromic_Tree {
  int next[maxn][26];
  int fail[maxn];
  int len[maxn];
  int S[maxn];
  int last;
  int diff[maxn], slink[maxn], fp[maxn];
  int n;
  int p;
  int newnode(int l) {
    for (int i = 0; i < 26; ++i) next[p][i] = 0;
    len[p] = l;
    return p++;
  }
  void init() {
    p = 0;
    newnode(0);
    newnode(-1);
    last = 0;
    n = 0;
    S[n] = -1;
    fail[0] = 1;
  }
  int get_fail(int x) {
    while (S[n - len[x] - 1] != S[n]) x = fail[x];
    return x;
  }
  int add(int c) {
    c -= 'a';
    S[++n] = c;
    int cur = get_fail(last);
    if (!next[cur][c]) {
      int now = newnode(len[cur] + 2);
      fail[now] = next[get_fail(fail[cur])][c];
      next[cur][c] = now;
      diff[now] = len[now] - len[fail[now]];
      slink[now] =
          (diff[now] == diff[fail[now]] ? slink[fail[now]] : fail[now]);
    }
    last = next[cur][c];
    return last;
  }
  void solve(int dp[], int pre[], char s[], int n) {
    int i, j;
    init();
    dp[0] = 0;
    fp[0] = 1;
    for (i = 1; i <= n; i++) {
      for (j = add(s[i]); j; j = slink[j]) {
        fp[j] = i - (len[slink[j]] + diff[j]);
        if (diff[fail[j]] == diff[j] && dp[fp[j]] > dp[fp[fail[j]]])
          fp[j] = fp[fail[j]];
        if (!(i & 1) && dp[i] > dp[fp[j]] + 1) {
          dp[i] = dp[fp[j]] + 1;
          pre[i] = fp[j];
        }
      }
      if (!(i & 1) && s[i - 1] == s[i] && dp[i] >= dp[i - 2]) {
        dp[i] = dp[i - 2];
        pre[i] = i - 2;
      }
    }
  }
} Pt;
char s1[maxn], s2[maxn], ss[maxn];
int ans[maxn], pre[maxn];
int main() {
  int n, i;
  scanf(" %s", s1);
  scanf(" %s", s2);
  n = strlen(s1);
  for (i = 0; i < n; i++) {
    ss[i * 2 + 1] = s1[i];
    ss[i * 2 + 2] = s2[i];
  }
  n <<= 1;
  memset(ans, 0x3f, sizeof(ans));
  Pt.solve(ans, pre, ss, n);
  if (ans[n] > n) return puts("-1"), 0;
  printf("%d\n", ans[n]);
  for (i = n; i; i = pre[i]) {
    if (i - pre[i] > 2) printf("%d %d\n", pre[i] / 2 + 1, i / 2);
  }
  return 0;
}
