#include <bits/stdc++.h>
using std::max;
using std::min;
const int inf = 0x3f3f3f3f, Inf = 0x7fffffff;
const long long INF = 0x3f3f3f3f3f3f3f3f;
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
template <typename _Tp>
_Tp gcd(const _Tp &a, const _Tp &b) {
  return (!b) ? a : gcd(b, a % b);
}
template <typename _Tp>
inline _Tp abs(const _Tp &a) {
  return a >= 0 ? a : -a;
}
template <typename _Tp>
inline void chmax(_Tp &a, const _Tp &b) {
  (a < b) && (a = b);
}
template <typename _Tp>
inline void chmin(_Tp &a, const _Tp &b) {
  (b < a) && (a = b);
}
template <typename _Tp>
inline void read(_Tp &x) {
  char ch(getchar());
  bool f(false);
  while (!isdigit(ch)) f |= ch == 45, ch = getchar();
  x = ch & 15, ch = getchar();
  while (isdigit(ch)) x = (((x << 2) + x) << 1) + (ch & 15), ch = getchar();
  f && (x = -x);
}
template <typename _Tp, typename... Args>
inline void read(_Tp &t, Args &...args) {
  read(t);
  read(args...);
}
inline int read_str(char *s) {
  char ch(getchar());
  while (ch == ' ' || ch == '\r' || ch == '\n') ch = getchar();
  char *tar = s;
  *tar = ch, ch = getchar();
  while (ch != ' ' && ch != '\r' && ch != '\n' && ch != EOF)
    *(++tar) = ch, ch = getchar();
  return tar - s + 1;
}
const int N = 1000005;
char a[N], b[N], s[N];
int dp[N], pre[N];
std::pair<int, int> f[N];
int last, node_cnt;
int fail[N], len[N], dif[N], slink[N];
int ch[N][26];
int calc(int x, int n) {
  while (s[n] != s[n - len[x] - 1]) x = fail[x];
  return x;
}
void insert(int x) {
  int nd = calc(last, x), c = s[x] - 97;
  if (!ch[nd][c]) {
    int cur = ++node_cnt;
    len[cur] = len[nd] + 2;
    fail[cur] = ch[calc(fail[nd], x)][c];
    dif[cur] = len[cur] - len[fail[cur]];
    slink[cur] = dif[cur] == dif[fail[cur]] ? slink[fail[cur]] : fail[cur];
    ch[nd][c] = cur;
  }
  last = ch[nd][c];
}
int main() {
  last = node_cnt = 1;
  fail[0] = 1, len[0] = 0, fail[1] = 1, len[1] = -1;
  int n = read_str(a + 1);
  read_str(b + 1);
  int m = 0;
  for (int i = 1; i <= n; ++i) s[++m] = a[i], s[++m] = b[i];
  memset(dp, 63, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= m; ++i) {
    insert(i);
    if (!(i & 1) && s[i] == s[i - 1]) dp[i] = dp[i - 2], pre[i] = i - 2;
    for (int k = last; k > 1; k = slink[k]) {
      f[k] = std::make_pair(dp[i - len[slink[k]] - dif[k]],
                            i - len[slink[k]] - dif[k]);
      if (slink[k] != fail[k] && f[fail[k]] < f[k]) f[k] = f[fail[k]];
      if (!(i & 1) && f[k].first + 1 < dp[i])
        dp[i] = f[k].first + 1, pre[i] = f[k].second;
    }
  }
  if (dp[m] >= inf)
    printf("-1\n");
  else {
    printf("%d\n", dp[m]);
    int cur = m;
    while (cur) {
      int tmp = pre[cur];
      if (tmp != cur - 2) printf("%d %d\n", (tmp >> 1) + 1, cur >> 1);
      cur = tmp;
    }
  }
  return 0;
}

### Prompt

In Cpp, your task is to solve the following 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

### Response

```cpp
#include <bits/stdc++.h>
using std::max;
using std::min;
const int inf = 0x3f3f3f3f, Inf = 0x7fffffff;
const long long INF = 0x3f3f3f3f3f3f3f3f;
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
template <typename _Tp>
_Tp gcd(const _Tp &a, const _Tp &b) {
  return (!b) ? a : gcd(b, a % b);
}
template <typename _Tp>
inline _Tp abs(const _Tp &a) {
  return a >= 0 ? a : -a;
}
template <typename _Tp>
inline void chmax(_Tp &a, const _Tp &b) {
  (a < b) && (a = b);
}
template <typename _Tp>
inline void chmin(_Tp &a, const _Tp &b) {
  (b < a) && (a = b);
}
template <typename _Tp>
inline void read(_Tp &x) {
  char ch(getchar());
  bool f(false);
  while (!isdigit(ch)) f |= ch == 45, ch = getchar();
  x = ch & 15, ch = getchar();
  while (isdigit(ch)) x = (((x << 2) + x) << 1) + (ch & 15), ch = getchar();
  f && (x = -x);
}
template <typename _Tp, typename... Args>
inline void read(_Tp &t, Args &...args) {
  read(t);
  read(args...);
}
inline int read_str(char *s) {
  char ch(getchar());
  while (ch == ' ' || ch == '\r' || ch == '\n') ch = getchar();
  char *tar = s;
  *tar = ch, ch = getchar();
  while (ch != ' ' && ch != '\r' && ch != '\n' && ch != EOF)
    *(++tar) = ch, ch = getchar();
  return tar - s + 1;
}
const int N = 1000005;
char a[N], b[N], s[N];
int dp[N], pre[N];
std::pair<int, int> f[N];
int last, node_cnt;
int fail[N], len[N], dif[N], slink[N];
int ch[N][26];
int calc(int x, int n) {
  while (s[n] != s[n - len[x] - 1]) x = fail[x];
  return x;
}
void insert(int x) {
  int nd = calc(last, x), c = s[x] - 97;
  if (!ch[nd][c]) {
    int cur = ++node_cnt;
    len[cur] = len[nd] + 2;
    fail[cur] = ch[calc(fail[nd], x)][c];
    dif[cur] = len[cur] - len[fail[cur]];
    slink[cur] = dif[cur] == dif[fail[cur]] ? slink[fail[cur]] : fail[cur];
    ch[nd][c] = cur;
  }
  last = ch[nd][c];
}
int main() {
  last = node_cnt = 1;
  fail[0] = 1, len[0] = 0, fail[1] = 1, len[1] = -1;
  int n = read_str(a + 1);
  read_str(b + 1);
  int m = 0;
  for (int i = 1; i <= n; ++i) s[++m] = a[i], s[++m] = b[i];
  memset(dp, 63, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= m; ++i) {
    insert(i);
    if (!(i & 1) && s[i] == s[i - 1]) dp[i] = dp[i - 2], pre[i] = i - 2;
    for (int k = last; k > 1; k = slink[k]) {
      f[k] = std::make_pair(dp[i - len[slink[k]] - dif[k]],
                            i - len[slink[k]] - dif[k]);
      if (slink[k] != fail[k] && f[fail[k]] < f[k]) f[k] = f[fail[k]];
      if (!(i & 1) && f[k].first + 1 < dp[i])
        dp[i] = f[k].first + 1, pre[i] = f[k].second;
    }
  }
  if (dp[m] >= inf)
    printf("-1\n");
  else {
    printf("%d\n", dp[m]);
    int cur = m;
    while (cur) {
      int tmp = pre[cur];
      if (tmp != cur - 2) printf("%d %d\n", (tmp >> 1) + 1, cur >> 1);
      cur = tmp;
    }
  }
  return 0;
}

```