#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int inf = 0x3f3f3f3f;
int f[N];
struct PAM {
  static const int N = ::N, M = 26;
  int s[N], len[N], ne[N][M], fail[N], cnt[N], dep[N], id[N], no[N], last, n, p,
      slink[N], dif[N];
  inline int newnode(int l) {
    fill_n(ne[p], M, 0);
    cnt[p] = dep[p] = 0;
    len[p] = l;
    return p++;
  }
  inline void init() {
    newnode(p = 0), newnode(s[0] = -1), fail[last = n = 0] = 1;
  }
  inline int getfail(int x) {
    while (s[n - len[x] - 1] != s[n]) x = fail[x];
    return x;
  }
  inline void add(int c) {
    s[++n] = c;
    int cur = getfail(last);
    if (!ne[cur][c]) {
      int now = newnode(len[cur] + 2);
      fail[now] = ne[getfail(fail[cur])][c];
      ne[cur][c] = now;
      dep[now] = dep[fail[now]] + 1;
    }
    last = ne[cur][c], cnt[last]++;
    id[n] = last, no[last] = n;
    dif[last] = len[last] - len[fail[last]];
    dif[last] == dif[fail[last]] ? slink[last] = slink[fail[last]]
                                 : slink[last] = fail[last];
  }
  inline void build() {
    for (int i = (p)-1; i >= (0); --i) cnt[fail[i]] += cnt[i];
  }
} pam;
char s[N], t1[N], t2[N];
int n;
int pre[N];
int g[N];
int main() {
  scanf("%s%s", (t1 + 1), t2 + 1);
  int L = strlen(t1 + 1);
  for (int i = (1); i < (L + 1); i++) {
    s[++n] = t1[i], s[++n] = t2[i];
  }
  memset(f, 0x3f, sizeof(f));
  f[0] = 0;
  pam.init();
  for (int i = (1); i < (n + 1); i++) {
    pam.add(s[i] - 'a');
    for (int j = pam.last; j > 1; j = pam.slink[j]) {
      g[j] = i - pam.len[pam.slink[j]] - pam.dif[j];
      int fj = pam.fail[j];
      if (pam.dif[j] == pam.dif[fj] && f[g[j]] > f[g[fj]]) g[j] = g[fj];
      if (i % 2 == 0 && f[i] > f[g[j]] + 1) f[i] = f[g[j]] + 1, pre[i] = g[j];
    }
    if (i % 2 == 0 && s[i] == s[i - 1] && f[i] > f[i - 2])
      f[i] = f[i - 2], pre[i] = i - 2;
  }
  if (f[n] == inf) {
    printf("-1");
  } else {
    printf("%d\n", f[n]);
    for (int i = n; i >= 1; i = pre[i]) {
      int l = pre[i] / 2 + 1, r = i / 2;
      if (l == r) continue;
      printf("%d %d\n", l, r);
    }
  }
  return 0;
}

### Prompt

Construct a cpp code solution to the problem outlined:

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int inf = 0x3f3f3f3f;
int f[N];
struct PAM {
  static const int N = ::N, M = 26;
  int s[N], len[N], ne[N][M], fail[N], cnt[N], dep[N], id[N], no[N], last, n, p,
      slink[N], dif[N];
  inline int newnode(int l) {
    fill_n(ne[p], M, 0);
    cnt[p] = dep[p] = 0;
    len[p] = l;
    return p++;
  }
  inline void init() {
    newnode(p = 0), newnode(s[0] = -1), fail[last = n = 0] = 1;
  }
  inline int getfail(int x) {
    while (s[n - len[x] - 1] != s[n]) x = fail[x];
    return x;
  }
  inline void add(int c) {
    s[++n] = c;
    int cur = getfail(last);
    if (!ne[cur][c]) {
      int now = newnode(len[cur] + 2);
      fail[now] = ne[getfail(fail[cur])][c];
      ne[cur][c] = now;
      dep[now] = dep[fail[now]] + 1;
    }
    last = ne[cur][c], cnt[last]++;
    id[n] = last, no[last] = n;
    dif[last] = len[last] - len[fail[last]];
    dif[last] == dif[fail[last]] ? slink[last] = slink[fail[last]]
                                 : slink[last] = fail[last];
  }
  inline void build() {
    for (int i = (p)-1; i >= (0); --i) cnt[fail[i]] += cnt[i];
  }
} pam;
char s[N], t1[N], t2[N];
int n;
int pre[N];
int g[N];
int main() {
  scanf("%s%s", (t1 + 1), t2 + 1);
  int L = strlen(t1 + 1);
  for (int i = (1); i < (L + 1); i++) {
    s[++n] = t1[i], s[++n] = t2[i];
  }
  memset(f, 0x3f, sizeof(f));
  f[0] = 0;
  pam.init();
  for (int i = (1); i < (n + 1); i++) {
    pam.add(s[i] - 'a');
    for (int j = pam.last; j > 1; j = pam.slink[j]) {
      g[j] = i - pam.len[pam.slink[j]] - pam.dif[j];
      int fj = pam.fail[j];
      if (pam.dif[j] == pam.dif[fj] && f[g[j]] > f[g[fj]]) g[j] = g[fj];
      if (i % 2 == 0 && f[i] > f[g[j]] + 1) f[i] = f[g[j]] + 1, pre[i] = g[j];
    }
    if (i % 2 == 0 && s[i] == s[i - 1] && f[i] > f[i - 2])
      f[i] = f[i - 2], pre[i] = i - 2;
  }
  if (f[n] == inf) {
    printf("-1");
  } else {
    printf("%d\n", f[n]);
    for (int i = n; i >= 1; i = pre[i]) {
      int l = pre[i] / 2 + 1, r = i / 2;
      if (l == r) continue;
      printf("%d %d\n", l, r);
    }
  }
  return 0;
}

```