#include <bits/stdc++.h>
const int N = 1000005;
int n, len[N], fail[N], lst;
std::string s, t;
int nxt[N][26], buf[N], now;
int anc[N], idx = 1;
int find(int x) {
  while (buf[now] != buf[now - len[x] - 1]) x = fail[x];
  return x;
}
void append(char ch) {
  buf[++now] = ch;
  int cur = find(lst);
  if (!nxt[cur][ch]) {
    int now = ++idx;
    len[now] = len[cur] + 2;
    fail[now] = nxt[find(fail[cur])][ch];
    nxt[cur][ch] = now;
    if (fail[now]) {
      anc[now] = len[now] + len[fail[fail[now]]] == len[fail[now]] * 2
                     ? anc[fail[now]]
                     : now;
    } else
      anc[now] = now;
  }
  lst = nxt[cur][ch];
}
const std::pair<int, int> inf(0x3f3f3f3f, -1);
std::pair<int, int> dp[N], min[N];
std::pair<int, int> operator+(std::pair<int, int> p, int x) {
  return std::pair<int, int>(p.first + x, p.second);
}
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0);
  std::cin >> s >> t, n = s.size();
  len[1] = -1, fail[0] = 1;
  for (int i = 1; i <= n * 2; ++i) dp[i] = inf;
  for (int i = 1; i <= n * 2; ++i) {
    append((i & 1 ? s : t)[i - 1 >> 1]);
    for (int p = lst; p > 1; p = fail[anc[p]]) {
      min[p] = anc[p] == p ? inf : min[fail[p]];
      std::pair<int, int> ret = std::min(
          std::pair<int, int>(dp[i - len[anc[p]]].first + 1, i - len[anc[p]]),
          min[p]);
      min[p] = std::min(min[p], ret);
      if (i % 2 == 0) {
        dp[i] = std::min(dp[i], min[p]);
      }
    }
    if (i % 2 == 0 && s[i - 1 >> 1] == t[i - 1 >> 1])
      dp[i] = std::min(dp[i], std::pair<int, int>(dp[i - 2].first, i - 2));
  }
  if (dp[n * 2] == inf)
    std::cout << "-1\n";
  else {
    std::cout << dp[n * 2].first << '\n';
    for (int p = n * 2; p; p = dp[p].second)
      if (p - dp[p].second > 2)
        std::cout << dp[p].second / 2 + 1 << ' ' << p / 2 << '\n';
  }
  return 0;
}
