#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7;
const int M = 100;
char s[N], t[N], str[2 * N];
pair<int, int> PL[2 * N], GPL[2 * N];
tuple<int, int, int> g[M], G[M];
void Palindromic(char *str) {
  const char *S = str - 1;
  int n = strlen(str);
  int G_size = 0;
  PL[0] = {0, 0};
  for (int j = (1); j < (n + 1); ++j) {
    int i, d, k, g_size = 0;
    swap(g_size, G_size);
    for (int _ = (0); _ < (g_size); ++_) g[_] = G[_];
    for (int _ = (0); _ < (g_size); ++_) {
      tie(i, d, k) = g[_];
      if (i > 1 && S[i - 1] == S[j]) G[G_size++] = {i - 1, d, k};
    }
    g_size = 0;
    int r = -j;
    for (int _ = (0); _ < (G_size); ++_) {
      tie(i, d, k) = G[_];
      if (i - r != d) {
        g[g_size++] = {i, i - r, 1};
        if (k > 1) g[g_size++] = {i + d, d, k - 1};
      } else
        g[g_size++] = {i, d, k};
      r = i + (k - 1) * d;
    }
    if (j > 1 && S[j - 1] == S[j]) {
      g[g_size++] = {j - 1, j - 1 - r, 1};
      r = j - 1;
    }
    g[g_size++] = {j, j - r, 1};
    G_size = 0;
    tie(i, d, k) = g[0];
    for (int _ = (1); _ < (g_size); ++_) {
      if (get<1>(g[_]) == d)
        k += get<2>(g[_]);
      else {
        G[G_size++] = {i, d, k};
        tie(i, d, k) = g[_];
      }
    }
    G[G_size++] = {i, d, k};
    PL[j] = {n + 1, 0};
    if (j % 2 == 0 && S[j - 1] == S[j])
      PL[j] = min(PL[j], make_pair(PL[j - 2].first, j - 2));
    for (int _ = (0); _ < (G_size); ++_) {
      tie(i, d, k) = G[_];
      r = i + (k - 1) * d;
      pair<int, int> m = {PL[r - 1].first + 1, r - 1};
      if (k > 1) m = min(m, GPL[i - d]);
      if (d <= i) GPL[i - d] = m;
      if (~j & 1) PL[j] = min(PL[j], m);
    }
  }
}
bool same(int l, int r, const char *s, const char *t) {
  for (int i = (l); i < (r + 1); ++i)
    if (s[i] != t[i]) return false;
  return true;
}
int main() {
  scanf(" %s %s", s, t);
  int n = strlen(s);
  for (int i = (0); i < (n); ++i) {
    str[2 * i] = s[i];
    str[2 * i + 1] = t[i];
  }
  str[2 * n] = 0;
  Palindromic(str);
  if (PL[2 * n].first > n) {
    puts("-1");
  } else {
    vector<pair<int, int> > ans;
    for (int r = 2 * n; r > 0; r = PL[r].second) {
      int L = PL[r].second / 2;
      int R = (r - 1) / 2;
      if (!same(L, R, s, t)) ans.emplace_back(make_pair(L + 1, R + 1));
    }
    printf("%d\n", ans.size());
    for (auto p : ans) printf("%d %d\n", p.first, p.second);
  }
  return 0;
}
