Problem: Hurricane came to Berland and to suburbs Stringsvill. You are going to it to check if it's all right with you favorite string. Hurrinace broke it a bit by reversing some of its non-intersecting substrings. You have a photo of this string before hurricane and you want to restore it to original state using reversing minimum possible number of its substrings and find out which substrings you should reverse.

You are given a string s — original state of your string and string t — state of the string after hurricane. You should select k non-intersecting substrings of t in such a way that after reverse of these substrings string will be equal s and k is minimum possible.

Input

First line of input contains string s and second line contains string t. Both strings have same length and consist of lowercase English letters. 1 ≤ |s| = |t| ≤ 5·105

Output

In first line print k — minimum number of substrings you should reverse. Next output k lines. Each line should contain two integers li, ri meaning that you should reverse substring from symbol number li to symbol ri (strings are 1-indexed). These substrings shouldn't intersect. If there are multiple answers print any. If it's impossible to restore string output -1.

Example

Input

abcxxxdef
cbaxxxfed


Output

2
7 9
1 3

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
struct state {
  int odd, even;
  int oddf, evenf;
};
namespace eertree {
int nxt[MAXN][26];
int par[MAXN], len[MAXN], slink[MAXN], ptr[MAXN], diff[MAXN], series[MAXN], piv;
void clear(int n = MAXN) {
  memset(par, 0, sizeof(int) * n);
  memset(len, 0, sizeof(int) * n);
  memset(slink, 0, sizeof(int) * n);
  memset(nxt, 0, sizeof(int) * 26 * n);
  piv = 0;
}
void init(int n, char *a) {
  par[0] = 0;
  par[1] = 1;
  a[0] = -1;
  len[0] = -1;
  piv = 1;
  int cur = 1;
  for (int i = 1; i <= n; i++) {
    while (a[i] != a[i - len[cur] - 1]) cur = slink[cur];
    if (!nxt[cur][a[i]]) {
      nxt[cur][a[i]] = ++piv;
      par[piv] = cur;
      len[piv] = len[cur] + 2;
      int lnk = slink[cur];
      while (a[i] != a[i - len[lnk] - 1]) {
        lnk = slink[lnk];
      }
      if (nxt[lnk][a[i]]) lnk = nxt[lnk][a[i]];
      if (len[piv] == 1 || lnk == 0) lnk = 1;
      slink[piv] = lnk;
      diff[piv] = len[piv] - len[lnk];
      if (diff[piv] == diff[lnk])
        series[piv] = series[lnk];
      else
        series[piv] = piv;
    }
    cur = nxt[cur][a[i]];
    ptr[i] = cur;
  }
}
int query(int s, int e) {
  int pos = ptr[e];
  while (len[pos] >= e - s + 1) {
    if (len[pos] % diff[pos] == (e - s + 1) % diff[pos] &&
        len[series[pos]] <= e - s + 1)
      return true;
    pos = series[pos];
    pos = slink[pos];
  }
  return false;
}
state min(state l, state r) {
  state x;
  if (l.odd <= r.odd)
    x.odd = l.odd, x.oddf = l.oddf;
  else
    x.odd = r.odd, x.oddf = r.oddf;
  if (l.even <= r.even)
    x.even = l.even, x.evenf = l.evenf;
  else
    x.even = r.even, x.evenf = r.evenf;
  return x;
}
vector<state> minimum_partition(int n, char *str) {
  vector<state> dp(n + 1);
  vector<state> series_ans(n + 10);
  dp[0] = {(int)1e9 + 1, 0, 0, 0};
  for (int i = 1; i <= n; i++) {
    dp[i] = {(int)1e9 + 1, (int)1e9, i, i};
    if (i % 2 == 0 && str[i - 1] == str[i]) {
      auto v = dp[i - 2];
      v.oddf = v.evenf = i - 2;
      dp[i] = min(dp[i], v);
    }
    for (int j = ptr[i]; len[j] > 0;) {
      int slv = slink[series[j]];
      auto x = dp[i - len[slv] - diff[j]];
      x.oddf = x.evenf = i - len[slv] - diff[j];
      series_ans[j] = x;
      if (diff[j] == diff[slink[j]]) {
        series_ans[j] = min(series_ans[j], series_ans[slink[j]]);
      }
      auto val = series_ans[j];
      tie(val.odd, val.even) = pair<int, int>(val.even + 1, val.odd + 1);
      swap(val.oddf, val.evenf);
      dp[i] = min(dp[i], val);
      j = slv;
    }
    if (i & 1) {
      dp[i].odd = 1e9 + 1;
      dp[i].even = 1e9;
    }
  }
  return dp;
}
};  // namespace eertree
int n;
char buf1[MAXN], buf2[MAXN];
char str[MAXN];
int main() {
  scanf("%s %s", buf1, buf2);
  n = strlen(buf1) * 2;
  for (int i = 0; i < n / 2; i++) {
    str[2 * i + 1] = buf1[i] - 'a';
    str[2 * i + 2] = buf2[i] - 'a';
  }
  eertree::init(n, str);
  auto x = eertree::minimum_partition(n, str);
  if (min(x[n].odd, x[n].even) > 1e7) {
    puts("-1");
    return 0;
  }
  cout << min(x[n].odd, x[n].even) << endl;
  vector<pair<int, int> > trk;
  int pos = n;
  while (pos) {
    if (x[pos].odd <= x[pos].even) {
      if (x[pos].oddf < pos - 2) {
        trk.push_back(pair<int, int>(x[pos].oddf / 2 + 1, pos / 2));
        pos = x[pos].oddf;
      } else
        pos -= 2;
    } else {
      if (x[pos].evenf < pos - 2) {
        trk.push_back(pair<int, int>(x[pos].evenf / 2 + 1, pos / 2));
        pos = x[pos].evenf;
      } else
        pos -= 2;
    }
  }
  for (auto &i : trk) printf("%d %d\n", i.first, i.second);
}