#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
template <typename T>
bool vmin(T &a, T b) {
  return (a > b) ? (a = b, true) : false;
}
inline int cti(char x) { return x - 'a'; }
typedef class TrieNode {
 public:
  pair<int, int> g;
  int len;
  int dif;
  TrieNode *ch[26];
  TrieNode *fail, *slink;
} TrieNode;
TrieNode pool[N];
TrieNode *_top = pool;
TrieNode *newnode(int len) {
  _top->len = len;
  _top->g = pair<int, int>(N, -1);
  return _top++;
}
typedef class PalindromeTree {
 public:
  TrieNode *odd, *even;
  TrieNode *lst;
  int tp;
  char *s;
  PalindromeTree() : odd(newnode(-1)), even(newnode(0)) {
    odd->fail = odd;
    even->fail = odd;
    odd->dif = -1, even->dif = -1;
    odd->slink = even->slink = NULL;
    lst = even;
  }
  void reserve(int len) {
    s = new char[(len + 1)];
    s[0] = 0;
  }
  TrieNode *extend(TrieNode *p) {
    while (s[tp - p->len - 1] ^ s[tp]) p = p->fail;
    return p;
  }
  void extend(char x) {
    s[++tp] = x;
    int c = cti(x);
    TrieNode *&p = lst;
    p = extend(p);
    if (!p->ch[c]) {
      TrieNode *q = extend(p->fail)->ch[c];
      p->ch[c] = newnode(p->len + 2);
      (p = p->ch[c])->fail = q ? q : even;
      p->dif = p->len - p->fail->len;
      p->slink = (p->dif == p->fail->dif) ? (p->fail->slink) : p->fail;
    } else {
      p = p->ch[c];
    }
  }
} PalindromeTree;
int n;
char s[N], t[N];
PalindromeTree pam;
int f[N], ls[N];
int main() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= (n << 1); i++) {
    f[i] = N;
    ls[i] = -1;
  }
  ls[0] = -1;
  pam.reserve(n << 1);
  for (int i = 1; i <= (n << 1); i++) {
    pam.extend((i & 1) ? (s[(i + 1) >> 1]) : (t[i >> 1]));
    for (TrieNode *p = pam.lst; p && p->len > 0; p = p->slink) {
      int len = p->slink->len + p->dif;
      p->g = pair<int, int>(f[i - len] + (len > 2), i - len);
      if (p->dif == p->fail->dif) {
        pair<int, int> gf = p->fail->g;
        if (i - p->dif - gf.second == 2) {
          gf.first++;
        }
        vmin(p->g, gf);
      }
      if (!(i & 1) && vmin(f[i], p->g.first)) {
        ls[i] = p->g.second;
      }
    }
  }
  int p = n << 1;
  if (f[p] == N) {
    puts("-1");
  } else {
    printf("%d\n", f[p]);
    while (p) {
      if (p - ls[p] > 2) {
        printf("%d %d\n", (ls[p] >> 1) + 1, p >> 1);
      }
      p = ls[p];
    }
  }
  return 0;
}
