#include <bits/stdc++.h>
const int maxn = 500500 << 1;
using std::cin;
using std::cout;
char s0[maxn], s1[maxn], s[maxn];
int c[maxn][26], len[maxn], fail[maxn], big_fail[maxn];
int min_dp[maxn];
int tot, last;
int dp[maxn], prev[maxn];
inline void append(char* s) {
  for (; s[-1 - len[last]] != *s;) last = fail[last];
  int& now = c[last][*s - 'a'];
  if (!now) {
    len[now = ++tot] = len[last] + 2;
    int& x = fail[now] = fail[last];
    for (; s[-1 - len[x]] != *s;) x = fail[x];
    x = c[x][*s - 'a'];
    if (x == now) x = 0;
    big_fail[now] =
        len[now] - len[x] == len[x] - len[fail[x]] ? big_fail[x] : x;
  }
  last = now;
}
int n;
int main() {
  fail[0] = 1, len[++tot] = -1;
  std::ios::sync_with_stdio(false), cin.tie(0);
  cin >> s0 >> s1;
  n = strlen(s0) << 1;
  for (int i = 1; i <= n; ++i) {
    s[i] = (i & 1 ? s0 : s1)[i - 1 >> 1];
    append(s + i);
    dp[i] = 1e9;
    if (i % 2 == 0 && s[i] == s[i - 1]) {
      dp[i] = dp[i - 2];
      prev[i] = i - 2;
    }
    for (int x = last; x; x = big_fail[x]) {
      const int final = big_fail[x], prv = fail[x];
      min_dp[x] = i - len[final] - (len[x] - len[prv]);
      if (prv != final && dp[min_dp[prv]] < dp[min_dp[x]])
        min_dp[x] = min_dp[prv];
      if (i % 2 == 0 && dp[min_dp[x]] + 1 < dp[i]) {
        dp[i] = dp[min_dp[x]] + 1;
        prev[i] = min_dp[x];
      }
    }
  }
  if (dp[n] > 1e8) {
    cout << -1 << '\n';
  } else {
    cout << dp[n] << '\n';
    for (int i = n; i; i = prev[i]) {
      if (i - prev[i] > 2) {
        cout << prev[i] / 2 + 1 << ' ' << i / 2 << '\n';
      }
    }
  }
}
