#include <bits/stdc++.h>
using namespace std;
char stra[1000005];
char strb[1000005];
int allstr[1000005], n;
struct node {
  node *trans[26], *par, *qlink;
  int len, diff, series_ans, pos_of_dp;
} pool[1000005], *last, *tail = pool, *root;
node *newnode(int l) {
  node *res = tail++;
  res->len = l;
  return res;
}
void init() {
  node *zero = newnode(0);
  node *one = newnode(-1);
  zero->par = one;
  zero->qlink = one;
  zero->diff = 0;
  one->diff = 0;
  zero->series_ans = 0x5f5f5f5f;
  one->series_ans = 0x5f5f5f5f;
  root = last = zero;
}
node *get_par(const int &len, node *pos) {
  while (pos && allstr[len - pos->len - 1] != allstr[len]) {
    pos = pos->par;
  }
  return pos;
}
void build_palindrome(const int &e, const int &len) {
  node *cur = get_par(len, last);
  node *now;
  if (!cur->trans[e]) {
    now = newnode(cur->len + 2);
    cur->trans[e] = now;
    node *p = get_par(len, cur->par);
    if (p) now->par = p->trans[e];
    if (!now->par) now->par = root;
    now->diff = now->len - now->par->len;
    if (now->diff != now->par->diff) {
      now->qlink = now->par;
    } else {
      now->qlink = now->par->qlink;
    }
  }
  last = cur->trans[e];
}
int dp[1000005], pre[1000005];
int ans, l[1000005], r[1000005];
void dfs(int pos) {
  if (!pos) return;
  if (pre[pos] != pos - 2) l[++ans] = pre[pos] / 2 + 1, r[ans] = pos / 2;
  dfs(pre[pos]);
}
int main() {
  scanf("%s", stra + 1);
  scanf("%s", strb + 1);
  n = strlen(stra + 1);
  allstr[0] = -1;
  for (int i = 1; i <= n; ++i) {
    allstr[i * 2 - 1] = stra[i] - 'a';
    allstr[i * 2] = strb[i] - 'a';
    dp[i * 2 - 1] = 0x5f5f5f5f;
    dp[i * 2] = 0x5f5f5f5f;
  }
  dp[0] = 0;
  init();
  for (int i = 1; i <= n * 2; i++) {
    build_palindrome(allstr[i], i);
    if (allstr[i] == allstr[i - 1]) {
      dp[i] = dp[i - 2];
      pre[i] = i - 2;
    }
    for (node *p = last; p != root; p = p->qlink) {
      p->series_ans = dp[i - (p->diff + p->qlink->len)];
      p->pos_of_dp = i - (p->diff + p->qlink->len);
      if (p->par->diff == p->diff) {
        if (p->par->series_ans < p->series_ans) {
          p->series_ans = p->par->series_ans;
          p->pos_of_dp = p->par->pos_of_dp;
        }
      }
      if (i % 2 == 0 && p->series_ans + 1 < dp[i]) {
        dp[i] = p->series_ans + 1;
        pre[i] = p->pos_of_dp;
      }
    }
  }
  if (dp[n * 2] >= 0x5f5f5f5f) {
    printf("-1\n");
  } else {
    dfs(n * 2);
    printf("%d\n", ans);
    for (int i = 1; i <= ans; ++i) {
      printf("%d %d\n", l[i], r[i]);
    }
  }
}
