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;
struct node {
  int len, suff, in[29], diff, smart;
};
node tree[1005000];
int ptr = 2, curnode = 1;
string str;
char g[1005000], g2[1005000];
int rev[1005000];
pair<int, pair<int, int> > dp[1005000], dplink[1005000];
pair<int, int> ds = make_pair(1005000, 1005000);
void makepal(int indx) {
  int temp = curnode;
  while (1) {
    int len = tree[temp].len;
    if (indx - len >= 1 && str[indx] == str[indx - 1 - len]) break;
    temp = tree[temp].suff;
  }
  if (tree[temp].in[str[indx] - 'a']) {
    curnode = tree[temp].in[str[indx] - 'a'];
    rev[indx] = curnode;
    return;
  }
  tree[temp].in[str[indx] - 'a'] = ++ptr;
  dplink[ptr] = make_pair(1005000, ds);
  tree[ptr].len = tree[temp].len + 2;
  curnode = ptr;
  rev[indx] = curnode;
  temp = tree[temp].suff;
  if (tree[ptr].len == 1) {
    tree[ptr].suff = 2;
    return;
  }
  while (1) {
    int len = tree[temp].len;
    if (indx - len >= 1 && str[indx] == str[indx - 1 - len]) break;
    temp = tree[temp].suff;
  }
  int s = tree[curnode].suff = tree[temp].in[str[indx] - 'a'];
}
int vis[1005000][2];
int dp_func2(int v, int b) {
  if (v == 2) return v;
  if (vis[v][b] != -1) return vis[v][b];
  if (b == 0 && tree[v].len % 2 == 0) return vis[v][b] = v;
  return vis[v][b] = dp_func2(tree[v].suff, 0);
}
vector<pair<int, int> > vc;
void rec(int v) {
  set<int> s;
  if (v == 0) return;
  for (int i = dp[v].second.second; i >= dp[v].second.first; i--) {
    s.insert(str[i]);
  }
  assert(dp[v].second.second % 2 == 0 && dp[v].second.first % 2 != 0);
  int f = dp[v].second.second / 2;
  int g = (dp[v].second.first + 1) / 2;
  if (s.size() > 1) {
    vc.push_back(make_pair(g, f));
  }
  rec(dp[v].second.first - 1);
}
int sz(int v) { return tree[v].len; }
vector<int> my[30];
int func(int st, int en) {
  if (st > en || st > 1000000) return 1;
  int h = str[st] - 97;
  int r = upper_bound(my[h].begin(), my[h].end(), en) -
          lower_bound(my[h].begin(), my[h].end(), st);
  return !((r) == (en - st + 1));
}
int main() {
  tree[1].diff = 0;
  tree[1].len = -1;
  tree[1].suff = 1;
  tree[2].diff = 0;
  tree[2].suff = 1;
  tree[2].len = 0;
  scanf("%s", g);
  int n = strlen(g);
  scanf("%s", g2);
  str += '0';
  for (int i = 0; i < n; i++) {
    str += g[i];
    str += g2[i];
  }
  for (int i = 1; i < str.size(); i++) {
    my[str[i] - 97].push_back(i);
    makepal(i);
    dp[i] = make_pair(1005000, ds);
  }
  memset(vis, -1, sizeof vis);
  for (int i = 3; i <= ptr; i++) {
    int s = dp_func2(i, 1);
    tree[i].suff = s;
    int curnode = i;
    tree[curnode].diff = tree[curnode].len - tree[s].len;
    if (tree[curnode].diff != tree[s].diff)
      tree[curnode].smart = s;
    else
      tree[curnode].smart = tree[s].smart;
  }
  dp[0] = make_pair(0, make_pair(0, 0));
  for (int i = 1; i < str.size(); i++) {
    if (i & 1) continue;
    int last = dp_func2(rev[i], 0);
    for (; tree[last].len > 0; last = tree[last].smart) {
      int s = tree[last].smart;
      int f = tree[last].suff;
      dplink[last] = make_pair(1005000, ds);
      pair<int, pair<int, int> > ps = dplink[last] =
          min(dplink[last], dp[i - (sz(s) + tree[last].diff)]);
      int gett = func(ps.second.second + 1, i);
      dp[i] = min(dp[i], make_pair(ps.first + gett,
                                   make_pair(ps.second.second + 1, i)));
      if (tree[last].diff == tree[tree[last].suff].diff) {
        ps = dplink[last] = min(dplink[last], dplink[f]);
        gett = func(ps.second.second + 1, i);
        dp[i] = min(dp[i], make_pair(ps.first + gett,
                                     make_pair(ps.second.second + 1, i)));
      }
    }
  }
  if (dp[2 * n].first == 1005000) {
    cout << "-1";
    return 0;
  }
  rec(str.size() - 1);
  cout << vc.size() << endl;
  for (int i = 0; i < vc.size(); i++) {
    printf("%d %d\n", vc[i].first, vc[i].second);
  }
}