#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int ch[N][26], fa[N], len[N], ct, last;
int diff[N], anc[N];
void extend(int, int);
pair<int, int> series[N];
int ans[N], pre[N];
char s[N], t[N];
char str[N];
int main() {
  scanf("%s%s", s + 1, t + 1);
  int n = strlen(s + 1);
  int m = 0;
  for (int i = 1; i <= n; i++) {
    str[++m] = s[i], str[++m] = t[i];
  }
  for (int i = 1; i <= m; i++) s[i] = str[i];
  memset(ans, 0x3f, sizeof(ans));
  ans[0] = 0;
  ct = last = fa[0] = fa[1] = 1, len[1] = -1;
  for (int i = 1; i <= m; i++) {
    extend(s[i] - 'a', i);
    for (int u = last; u > 1; u = fa[anc[u]]) {
      series[u] = pair<int, int>(ans[i - len[anc[u]]], i - len[anc[u]]);
      if (diff[u] == diff[fa[u]]) series[u] = min(series[u], series[fa[u]]);
      if (i % 2 == 0 && ans[i] > series[u].first + 1) {
        ans[i] = series[u].first + 1;
        pre[i] = series[u].second;
      }
    }
    if (i > 1 && s[i] == s[i - 1] && ans[i] > ans[i - 2]) {
      ans[i] = ans[i - 2];
      pre[i] = i - 2;
    }
  }
  if (ans[m] > m / 2)
    puts("-1");
  else {
    printf("%d\n", ans[m]);
    int u = m;
    while (u) {
      int v = pre[u];
      if (u - v > 2) printf("%d %d\n", v / 2 + 1, u / 2);
      u = v;
    }
  }
}
void extend(int c, int i) {
  int p = last;
  while (s[i - len[p] - 1] != s[i]) p = fa[p];
  if (!ch[p][c]) {
    int np = ++ct, q = fa[p];
    while (s[i - len[q] - 1] != s[i]) q = fa[q];
    fa[np] = ch[q][c], ch[p][c] = np;
    len[np] = len[p] + 2;
    diff[np] = len[np] - len[fa[np]];
    anc[np] = diff[np] == diff[fa[np]] ? anc[fa[np]] : np;
  }
  last = ch[p][c];
}
