#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;
bool update(int &x, int y) {
  if (x > y) {
    x = y;
    return true;
  } else
    return false;
}
struct Palindromic_Tree {
  int next[maxn][26];
  int fail[maxn];
  int len[maxn];
  int S[maxn];
  int last;
  int n;
  int p;
  int newnode(int l) {
    for (int i = 0; i < 26; ++i) next[p][i] = 0;
    len[p] = l;
    return p++;
  }
  void init() {
    p = 0;
    newnode(0);
    newnode(-1);
    last = 0;
    n = 0;
    S[n] = -1;
    fail[0] = 1;
  }
  int get_fail(int x) {
    while (S[n - len[x] - 1] != S[n]) x = fail[x];
    return x;
  }
  int add(int c) {
    c -= 'a';
    S[++n] = c;
    int cur = get_fail(last);
    if (!next[cur][c]) {
      int now = newnode(len[cur] + 2);
      fail[now] = next[get_fail(fail[cur])][c];
      next[cur][c] = now;
    }
    last = next[cur][c];
    return last;
  }
} Pt;
char s1[maxn], s2[maxn], ss[maxn];
int ans[maxn], pre[maxn];
int main() {
  int n, i, j;
  scanf(" %s", s1);
  scanf(" %s", s2);
  n = strlen(s1);
  for (i = 0; i < n; i++) {
    ss[i * 2 + 1] = s1[i];
    ss[i * 2 + 2] = s2[i];
  }
  n <<= 1;
  Pt.init();
  memset(ans, 0x3f, sizeof(ans));
  ans[0] = 0;
  for (i = 1; i <= n; i++) {
    j = Pt.add(ss[i]);
    if (i & 1) continue;
    if (ss[i] == ss[i - 1] && update(ans[i], ans[i - 2])) pre[i] = i - 2;
    for (; j; j = Pt.fail[j]) {
      if (Pt.len[j] & 1) continue;
      if (update(ans[i], ans[i - Pt.len[j]] + 1)) pre[i] = i - Pt.len[j];
    }
  }
  if (ans[n] > n) return puts("-1"), 0;
  printf("%d\n", ans[n]);
  for (i = n; i; i = pre[i]) {
    if (i - pre[i] > 2) printf("%d %d\n", pre[i] / 2 + 1, i / 2);
  }
  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 mod = 1e9 + 7;
const int maxn = 1e6 + 5;
bool update(int &x, int y) {
  if (x > y) {
    x = y;
    return true;
  } else
    return false;
}
struct Palindromic_Tree {
  int next[maxn][26];
  int fail[maxn];
  int len[maxn];
  int S[maxn];
  int last;
  int n;
  int p;
  int newnode(int l) {
    for (int i = 0; i < 26; ++i) next[p][i] = 0;
    len[p] = l;
    return p++;
  }
  void init() {
    p = 0;
    newnode(0);
    newnode(-1);
    last = 0;
    n = 0;
    S[n] = -1;
    fail[0] = 1;
  }
  int get_fail(int x) {
    while (S[n - len[x] - 1] != S[n]) x = fail[x];
    return x;
  }
  int add(int c) {
    c -= 'a';
    S[++n] = c;
    int cur = get_fail(last);
    if (!next[cur][c]) {
      int now = newnode(len[cur] + 2);
      fail[now] = next[get_fail(fail[cur])][c];
      next[cur][c] = now;
    }
    last = next[cur][c];
    return last;
  }
} Pt;
char s1[maxn], s2[maxn], ss[maxn];
int ans[maxn], pre[maxn];
int main() {
  int n, i, j;
  scanf(" %s", s1);
  scanf(" %s", s2);
  n = strlen(s1);
  for (i = 0; i < n; i++) {
    ss[i * 2 + 1] = s1[i];
    ss[i * 2 + 2] = s2[i];
  }
  n <<= 1;
  Pt.init();
  memset(ans, 0x3f, sizeof(ans));
  ans[0] = 0;
  for (i = 1; i <= n; i++) {
    j = Pt.add(ss[i]);
    if (i & 1) continue;
    if (ss[i] == ss[i - 1] && update(ans[i], ans[i - 2])) pre[i] = i - 2;
    for (; j; j = Pt.fail[j]) {
      if (Pt.len[j] & 1) continue;
      if (update(ans[i], ans[i - Pt.len[j]] + 1)) pre[i] = i - Pt.len[j];
    }
  }
  if (ans[n] > n) return puts("-1"), 0;
  printf("%d\n", ans[n]);
  for (i = n; i; i = pre[i]) {
    if (i - pre[i] > 2) printf("%d %d\n", pre[i] / 2 + 1, i / 2);
  }
  return 0;
}

```