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;
using namespace chrono;
const int infinity = (int)1e9 + 42;
const int64_t llInfinity = (int64_t)1e18 + 256;
const int module = (int)1e9 + 7;
const long double eps = 1e-8;
mt19937_64 randGen(system_clock().now().time_since_epoch().count());
inline void raiseError(string errorCode) {
  cerr << "Error : " << errorCode << endl;
  exit(42);
}
inline int predict(int a, int b, int c) {
  if (a > b) {
    swap(a, b);
  }
  if (c == 0) {
    if (a < 2) {
      if (b < 2) {
        return -1;
      } else {
        return b / 2 + (b % 4 != 2);
      }
    } else {
      return (a + b) / 2;
    }
  } else if (c == 1) {
    if (a + b <= 1) {
      return -1;
    }
    if (a == 1 && b == 1) {
      return 0;
    }
    if (a < 2) {
      a = 2;
    }
    return (a + b) / 2 - (a % 4 == b % 4);
  } else {
    assert(false);
  }
}
struct State {
  int a, b, c;
};
inline int answer(const State &s) { return predict(s.a, s.b, s.c); }
struct CutString {
  int base, len;
};
inline void split(CutString s, CutString &l, CutString &r, int pt) {
  l = {s.base, pt};
  r = {s.base ^ (pt & 1), s.len - pt};
}
inline void merge(CutString &s, CutString l, CutString r) {
  if (!l.len || !r.len) {
    s = l.len ? l : r;
  } else {
    s.base = l.base;
    s.len = l.len + r.len - (l.base ^ r.base ^ (l.len & 1));
  }
}
inline State move(const State &s, int da, int db) {
  assert(da <= s.a && db <= s.b);
  CutString sa{0, s.a}, sb{s.c, s.b};
  CutString la, ra, lb, rb;
  split(sa, la, ra, da);
  split(sb, lb, rb, db);
  merge(sa, la, rb);
  merge(sb, lb, ra);
  return {sa.len, sb.len, sa.base ^ sb.base};
}
struct RealString {
  vector<pair<int, char> > str;
  int offs = 0;
};
inline void append(RealString &s, char c, int pos) {
  if (s.str.empty() || s.str.back().second != c) {
    s.str.emplace_back(pos - s.offs, c);
  }
}
inline void doSwap(RealString &a, RealString &b, int da, int db) {
  assert(0 <= da && da <= (int)a.str.size());
  assert(0 <= db && db <= (int)b.str.size());
  vector<pair<int, char> > ap(a.str.end() - da, a.str.end());
  vector<pair<int, char> > bp(b.str.end() - db, b.str.end());
  a.str.erase(a.str.end() - da, a.str.end());
  b.str.erase(b.str.end() - db, b.str.end());
  int al = ap.empty() ? 0 : (ap[0].first + a.offs + 1);
  int bl = bp.empty() ? 0 : (bp[0].first + b.offs + 1);
  int ao = a.offs, bo = b.offs;
  a.offs -= al - bl;
  b.offs -= bl - al;
  cout << al << " " << bl << "\n";
  for (auto &it : ap) {
    append(b, it.second, it.first + ao);
  }
  for (auto &it : bp) {
    append(a, it.second, it.first + bo);
  }
}
inline State genState(const RealString &a, const RealString &b) {
  return State{(int)a.str.size(), (int)b.str.size(),
               a.str.back().second != b.str.back().second};
}
signed main() {
  ios_base::sync_with_stdio(false);
  string a, b;
  cin >> a >> b;
  RealString ra, rb;
  for (int i = (int)a.size() - 1; i >= 0; i--) {
    append(ra, a[i], i);
  }
  for (int i = (int)b.size() - 1; i >= 0; i--) {
    append(rb, b[i], i);
  }
  int res = answer(genState(ra, rb));
  cout << res << "\n";
  while (res > 0) {
    State s = genState(ra, rb);
    assert(answer(s) == res);
    bool ok = false;
    for (int i = 0; i <= s.a && i <= 6; i++) {
      for (int j = 0; j <= s.b && j <= 6; j++) {
        State ns = move(s, i, j);
        if (answer(ns) == res - 1) {
          doSwap(ra, rb, i, j);
          res--;
          ok = true;
          break;
        }
      }
      if (ok) {
        break;
      }
    }
    assert(ok);
  }
  return 0;
}