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.
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
using namespace std;
namespace {
namespace shik {
template <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%" SCNd64, &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%" PRId64, x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T>
void _W(const vector<T> &x) {
  for (auto i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &...tail) {
  _W(head);
  putchar(sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
template <class T, class F = less<T>>
void sort_uniq(vector<T> &v, F f = F()) {
  sort(begin(v), end(v), f);
  v.resize(unique(begin(v), end(v)) - begin(v));
}
template <class T>
inline T bit(T x, int i) {
  return (x >> i) & 1;
}
template <class T>
inline bool chkmax(T &a, const T &b) {
  return b > a ? a = b, true : false;
}
template <class T>
inline bool chkmin(T &a, const T &b) {
  return b < a ? a = b, true : false;
}
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
const int N = 2e5 + 10;
struct P {
  char c;
  int l;
};
char s1[N], s2[N];
deque<P> build(char *s) {
  deque<P> v;
  int n = strlen(s);
  for (int i = 0, j; i < n; i = j) {
    for (j = i; s[i] == s[j]; j++)
      ;
    v.push_back({s[i], j - i});
  }
  return v;
}
void merge(deque<P> &a, deque<P> &b) {
  if (a.empty()) return;
  if (b.empty()) {
    b = a;
    return;
  }
  if (a.back().c == b.front().c) {
    b.front().l += a.back().l;
    a.pop_back();
  }
  while (!a.empty()) {
    b.push_front(a.back());
    a.pop_back();
  }
}
pair<string, string> go(string z1, string z2, int l1, int l2) {
  string nz1 = z2.substr(0, l2) + z1.substr(l1);
  string nz2 = z1.substr(0, l1) + z2.substr(l2);
  return {nz1, nz2};
}
deque<P> q1, q2;
vector<pair<int, int>> sol;
void go(int k1, int k2) {
  assert(k1 <= ((int)(q1).size()));
  assert(k2 <= ((int)(q2).size()));
  deque<P> t1, t2;
  while (k1--) {
    t1.push_back(q1.front());
    q1.pop_front();
  }
  while (k2--) {
    t2.push_back(q2.front());
    q2.pop_front();
  }
  int l1 = 0, l2 = 0;
  for (auto i : t1) l1 += i.l;
  for (auto i : t2) l2 += i.l;
  sol.push_back({l1, l2});
  swap(t1, t2);
  merge(t1, q1);
  merge(t2, q2);
}
string reduce(const string &s) {
  string t;
  for (auto c : s)
    if (t.empty() || c != t.back()) t.push_back(c);
  return t;
}
int slow(string z1, string z2) {
  z1 = reduce(z1);
  z2 = reduce(z2);
  static map<pair<string, string>, int> dp;
  if (((int)(z1).size()) == 1 && ((int)(z2).size()) == 1) return 0;
  auto k = make_pair(z1, z2);
  if (dp.count(k)) return dp[k];
  int mi = INT_MAX;
  for (int i = 0; i < int(((int)(z1).size()) + 1); i++)
    for (int j = 0; j < int(((int)(z2).size()) + 1); j++) {
      auto [nz1, nz2] = go(z1, z2, i, j);
      nz1 = reduce(nz1);
      nz2 = reduce(nz2);
      if (((int)(nz1).size()) + ((int)(nz2).size()) <
              ((int)(z1).size()) + ((int)(z2).size()) ||
          max(((int)(nz1).size()), ((int)(nz2).size())) <
              max(((int)(z1).size()), ((int)(z2).size()))) {
        if (chkmin(mi, slow(nz1, nz2) + 1)) {
        }
      }
    }
  return dp[k] = mi;
}
void main() {
  R(s1, s2);
  q1 = build(s1);
  q2 = build(s2);
  while (q1.front().c == q2.front().c) {
    if (max(((int)(q1).size()), ((int)(q2).size())) >= 3 &&
        min(((int)(q1).size()), ((int)(q2).size())) >= 2) {
      if (((int)(q1).size()) > ((int)(q2).size()))
        go(2, 1);
      else
        go(1, 2);
    } else {
      if (((int)(q1).size()) > ((int)(q2).size()))
        go(((int)(q1).size()) >= 5 ? 3 : 1, 0);
      else
        go(0, ((int)(q2).size()) >= 5 ? 3 : 1);
    }
  }
  assert(!q1.empty() && !q2.empty());
  assert(q1.front().c != q2.front().c);
  while (((int)(q1).size()) > 1 || ((int)(q2).size()) > 1) {
    int k1 = 1, k2 = 1;
    if (((int)(q1).size()) >= ((int)(q2).size()) + 3)
      k1 = 3;
    else if (((int)(q2).size()) >= ((int)(q1).size()) + 3)
      k2 = 3;
    go(k1, k2);
  }
  W(((int)(sol).size()));
  for (auto i : sol) W(i.first, i.second);
}
}  // namespace shik
}  // namespace
int main() {
  shik::main();
  return 0;
}
