Problem: There are two strings s and t, consisting only of letters a and b. You can make the following operation several times: choose a prefix of s, a prefix of t and swap them. Prefixes can be empty, also a prefix can coincide with a whole string. 

Your task is to find a sequence of operations after which one of the strings consists only of a letters and the other consists only of b letters. The number of operations should be minimized.

Input

The first line contains a string s (1 ≤ |s| ≤ 2·105).

The second line contains a string t (1 ≤ |t| ≤ 2·105).

Here |s| and |t| denote the lengths of s and t, respectively. It is guaranteed that at least one of the strings contains at least one a letter and at least one of the strings contains at least one b letter.

Output

The first line should contain a single integer n (0 ≤ n ≤ 5·105) — the number of operations.

Each of the next n lines should contain two space-separated integers ai, bi — the lengths of prefixes of s and t to swap, respectively.

If there are multiple possible solutions, you can print any of them. It's guaranteed that a solution with given constraints exists.

Examples

Input

bab
bb


Output

2
1 0
1 3


Input

bbbb
aaa


Output

0

Note

In the first example, you can solve the problem in two operations:

  1. Swap the prefix of the first string with length 1 and the prefix of the second string with length 0. After this swap, you'll have strings ab and bbb. 
  2. Swap the prefix of the first string with length 1 and the prefix of the second string with length 3. After this swap, you'll have strings bbbb and a. 



In the second example, the strings are already appropriate, so no operations are needed.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int mod = (1e9) + 7;
const double eps = 1e-6;
const int siz = 2e5 + 5, siz2 = 21;
char s[siz], t[siz];
int s_sz, t_sz;
vector<pair<int, int>> moves;
vector<pair<int, int>> *sv, *tv;
bool rev;
int getval(vector<pair<int, int>> *ve, int ind) {
  return ind != -1 ? (*ve)[ind].second : 0;
}
void make_move(int si, int ti) {
  int scu = getval(sv, si), tcu = getval(tv, ti);
  moves.push_back({scu, tcu});
  vector<pair<int, int>> sc, tc;
  for (int i = ti + 1; i < tv->size(); i++) {
    int val = (*tv)[i].second - tcu;
    sc.push_back({(*tv)[i].first, val});
  }
  for (int i = si + 1; i < sv->size(); i++) {
    int val = (*sv)[i].second - scu;
    tc.push_back({(*sv)[i].first, val});
  }
  while (sv->size() > si + 1) {
    sv->pop_back();
  }
  while (tv->size() > ti + 1) {
    tv->pop_back();
  }
  int sf = 0, tf = 0;
  if (si != -1 && sc.size() > 0 && (*sv)[si].first == sc[0].first) {
    (*sv)[si].second += sc[0].second;
    sf++;
  }
  if (ti != -1 && tc.size() > 0 && (*tv)[ti].first == tc[0].first) {
    (*tv)[ti].second += tc[0].second;
    tf++;
  }
  for (int i = sf; i < sc.size(); i++) {
    int val = sc[i].second + scu;
    sv->push_back({sc[i].first, val});
  }
  for (int i = tf; i < tc.size(); i++) {
    int val = tc[i].second + tcu;
    tv->push_back({tc[i].first, val});
  }
  swap(sv, tv);
}
vector<pair<int, int>> *str_to_vctr(char *arr, int sz) {
  int co = 0;
  vector<pair<int, int>> *ret = new vector<pair<int, int>>();
  for (int i = 0; i < sz; i++) {
    if (i != 0 && arr[i] != arr[i - 1]) {
      ret->push_back({arr[i - 1], co});
    }
    co++;
  }
  ret->push_back({arr[sz - 1], co});
  return ret;
}
void fin() {
  while (sv->size() > 1) {
    make_move(sv->size() - 2, tv->size() - 2);
  }
}
void done() {
  int sz = moves.size();
  printf("%d\n", sz);
  for (auto m : moves) {
    if (rev) {
      swap(m.first, m.second);
    }
    printf("%d %d\n", m.first, m.second);
  }
  exit(0);
}
int main() {
  scanf("%s%s", s, t);
  s_sz = strlen(s);
  t_sz = strlen(t);
  sv = str_to_vctr(s, s_sz);
  tv = str_to_vctr(t, t_sz);
  int sv_sz = sv->size(), tv_sz = tv->size();
  if (sv_sz < tv_sz) {
    rev = true;
    swap(sv, tv);
    swap(sv_sz, tv_sz);
  }
  if (sv_sz == 1 && tv_sz == 1) {
    done();
  }
  if (sv_sz == tv_sz && (*sv)[0].first != (*tv)[0].first) {
    fin();
    done();
  }
  if ((*sv)[sv_sz - 1].first == (*tv)[tv_sz - 1].first) {
    if ((*sv)[0].first != (*tv)[0].first &&
        ((sv_sz % 2 == 0 && (sv_sz + tv_sz - 1) % 4 == 0) ||
         (sv_sz % 2 == 1 && (sv_sz + tv_sz + 1) % 4 == 0))) {
      if (tv_sz == 1) {
        make_move(sv_sz / 2 - 1, -1);
        make_move(sv->size() - 2, tv->size() - 1);
        make_move(0, -1);
      } else {
        int half = (sv_sz + tv_sz - 2) / 2;
        if ((*sv)[half - 1].first != (*tv)[tv_sz - 1].first) {
          half++;
        }
        make_move(half - 1, tv_sz - 2);
        if (sv->size() > tv->size()) {
          make_move(sv->size() - 2, tv->size() - 1);
        } else if (tv->size() > sv->size()) {
          make_move(sv->size() - 1, tv->size() - 2);
        }
      }
    } else {
      int half = (sv_sz + tv_sz - 1) / 2;
      if ((*sv)[half].first != (*tv)[tv_sz - 1].first) {
        half++;
      }
      make_move(half - 1, tv_sz - 1);
      if (sv->size() > tv->size()) {
        make_move(0, -1);
      } else if (tv->size() > sv->size()) {
        make_move(-1, 0);
      }
    }
  } else {
    if (((*sv)[0].first == (*tv)[0].first &&
         ((sv_sz % 2 == 1 && (sv_sz + tv_sz - 1) % 4 == 0) ||
          (sv_sz % 2 == 0 && (sv_sz + tv_sz + 1) % 4 == 0))) ||
        ((*sv)[0].first != (*tv)[0].first &&
         ((sv_sz % 2 == 1 && (sv_sz + tv_sz) % 4 == 0) ||
          (sv_sz % 2 == 0 && (sv_sz + tv_sz) % 4 != 0)))) {
      int tomove = sv_sz - (sv_sz + tv_sz) / 2;
      make_move(tomove - 1, -1);
    } else {
      if (tv_sz == 1) {
        if (sv_sz % 2 == 0) {
          make_move(sv_sz / 2 - 1, 0);
          make_move(sv->size() - 2, tv->size() - 1);
          make_move(0, -1);
        } else {
          make_move(sv_sz / 2, 0);
          make_move(sv->size() - 1, tv->size() - 2);
        }
      } else {
        int half = (sv_sz + tv_sz - 2) / 2;
        if ((*sv)[half - 1].first != (*tv)[tv_sz - 1].first) {
          half++;
        }
        make_move(half - 1, tv_sz - 2);
        if (sv->size() > tv->size()) {
          make_move(0, -1);
        } else if (tv->size() > sv->size()) {
          make_move(-1, 0);
        }
      }
    }
  }
  fin();
  done();
  return 0;
}