#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
const int inf = 1e9 + 10;
int n, curStringLen;
string s, t, T;
int dp[maxn], len[maxn], suff_link[maxn], prev_chain_link[maxn],
    preNode = 0, nxt[maxn][26], sz, chain_diff[maxn];
inline int doJob(int node) {
  while (T[curStringLen - 2 - len[node]] != T[curStringLen - 1])
    node = suff_link[node];
  return node;
}
pair<int, int> chain_dp[maxn];
inline void add_letter(int ch) {
  T[curStringLen++] = ch;
  preNode = doJob(preNode);
  if (nxt[preNode][ch]) {
    preNode = nxt[preNode][ch];
    return;
  }
  len[sz] = len[preNode] + 2;
  suff_link[sz] = nxt[doJob(suff_link[preNode])][ch];
  chain_diff[sz] = len[sz] - len[suff_link[sz]];
  prev_chain_link[sz] = (chain_diff[sz] == chain_diff[suff_link[sz]])
                            ? prev_chain_link[suff_link[sz]]
                            : suff_link[sz];
  preNode = nxt[preNode][ch] = sz++;
}
inline void eertreeInit() {
  suff_link[0] = 1;
  len[1] = -1;
  curStringLen = 1;
  T[0] = '!';
  sz = 2;
}
int lastL[maxn];
int32_t main() {
  cin >> s >> t;
  n = (int)s.size();
  T.resize(2 * n + 1);
  eertreeInit();
  n *= 2;
  for (int i = 1; i <= n; i++) dp[i] = inf;
  for (int i = 1; i <= n; i++) {
    if (i & 1)
      add_letter(s[i / 2] - 'a');
    else
      add_letter(t[i / 2 - 1] - 'a');
    bool fl = (i % 2) == 0;
    for (int node = preNode; len[node] > 0; node = prev_chain_link[node]) {
      int firstinChainLen = len[prev_chain_link[node]] + chain_diff[node];
      chain_dp[node].first = dp[i - firstinChainLen] + 1;
      chain_dp[node].second = i - firstinChainLen + 1;
      if (chain_diff[node] == chain_diff[suff_link[node]])
        chain_dp[node] = min(chain_dp[node], chain_dp[suff_link[node]]);
      if (fl)
        if (chain_dp[node].first < dp[i]) {
          dp[i] = chain_dp[node].first, lastL[i] = chain_dp[node].second;
        }
    }
    if (fl && dp[i - 2] < dp[i] && t[i / 2 - 1] == s[i / 2 - 1]) {
      dp[i] = dp[i - 2], lastL[i] = i - 1;
    }
  }
  if (dp[n] == inf) return cout << -1 << "\n", 0;
  cout << dp[n] << "\n";
  while (n) {
    if (lastL[n] + 2 < n) {
      cout << lastL[n] / 2 + 1 << " " << n / 2 << "\n";
    }
    n = lastL[n] - 1;
  }
}
