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>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const int INF = 1 << 30;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
int rint();
char rch();
long long rlong();
string inp[2];
vector<pair<int, int> > oq[2];
vector<pair<int, int> > q[2];
const int T = 0, B = 1;
vector<pair<int, int> > vans;
void vadd(int k, pair<int, int> &p) {
  if (q[k].size() == 0) {
    q[k].push_back(p);
  } else {
    if (p.second == q[k].back().second)
      q[k].back().first += p.first;
    else
      q[k].push_back(p);
  }
}
const int mn = (5e5) + 4;
template <typename LST>
struct LimitedVec {
  LST a[mn];
  int sz;
  void push_back(LST val) { a[sz++] = val; }
  LST *begin() { return &a[0]; }
  LST *end() { return &a[sz]; }
  void clear() { sz = 0; }
};
LimitedVec<pair<int, int> > g[2];
int tempc[2];
void sw(int top, int bot) {
  int vc[2];
  vc[T] = top;
  vc[B] = bot;
  for (int k = 0; k < 2; k++) tempc[k] = 0;
  for (int k = 0; k < 2; k++) g[k].clear();
  for (int k = 0; k < 2; k++) {
    for (int i = 0; i < vc[k]; i++) {
      tempc[k] += q[k].back().first;
      g[k].push_back(q[k].back());
      q[k].pop_back();
    }
    reverse(g[k].begin(), g[k].end());
  }
  for (int k = 0; k < 2; k++) {
    for (auto &w : g[k ^ 1]) vadd(k, w);
  }
  vans.push_back(make_pair(tempc[0], tempc[1]));
}
vector<pair<int, int> > final;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> inp[0] >> inp[1];
  for (int t = 0; t < 2; t++) {
    int now = 1;
    int sz = inp[t].size();
    for (int i = 1; i < sz; i++) {
      if (inp[t][i] != inp[t][i - 1]) {
        oq[t].push_back(make_pair(now, inp[t][i - 1] - 'a'));
        now = 1;
      } else
        now++;
    }
    oq[t].push_back(make_pair(now, inp[t][inp[t].size() - 1] - 'a'));
    reverse(oq[t].begin(), oq[t].end());
  }
  int total = q[0].size() + q[1].size();
  int half = total / 2;
  for (int k = 0; k < 2; k++) q[k] = oq[k];
  while (1) {
    if (q[0].size() == 1 && q[1].size() == 1 &&
        q[0].back().second != q[1].back().second) {
      break;
    }
    pair<pair<int, int>, pair<int, int> > best =
        make_pair(make_pair(1e9, 1e9), make_pair(1e9, 1e9));
    for (int wanttop = half - 2; wanttop <= half + 2; wanttop++) {
      int wantbot = total - wanttop;
      int taketop, takebot;
      if (q[0].size() > wanttop) {
        takebot = 1;
        taketop = q[0].size() - wanttop;
      } else {
        taketop = 1;
        takebot = q[1].size() - wantbot;
      }
      for (int tt = taketop - 2; tt <= taketop + 2; tt++) {
        for (int bb = takebot - 2; bb <= takebot; bb++) {
          if (0 <= tt && tt <= q[0].size() && 0 <= bb && bb <= q[1].size() &&
              tt + bb > 0) {
            int newtop = q[0].size() - tt + bb;
            if (q[0].size() > tt && bb > 0 &&
                q[0][q[0].size() - 1 - tt].second ==
                    q[1][q[1].size() - 1 - (bb - 1)].second)
              newtop--;
            int newbot = q[1].size() - bb + tt;
            if (q[1].size() > bb && tt > 0 &&
                q[1][q[1].size() - 1 - bb].second ==
                    q[0][q[0].size() - 1 - (tt - 1)].second)
              newbot--;
            chkmin(best,
                   make_pair(make_pair(newbot + newtop, abs(newtop - newbot)),
                             make_pair(tt, bb)));
          }
        }
      }
    }
    sw(best.second.first, best.second.second);
    ;
    ;
  }
  printf("%d\n", (int)vans.size());
  for (auto &w : vans) {
    printf("%d %d\n", w.first, w.second);
  }
}
static char stdinBuffer[1024];
static char *stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);
static const char *stdinPos = stdinDataEnd;
void readAhead(size_t amount) {
  size_t remaining = stdinDataEnd - stdinPos;
  if (remaining < amount) {
    memmove(stdinBuffer, stdinPos, remaining);
    size_t sz = fread(stdinBuffer + remaining, 1,
                      sizeof(stdinBuffer) - remaining, stdin);
    stdinPos = stdinBuffer;
    stdinDataEnd = stdinBuffer + remaining + sz;
    if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;
  }
}
int rint() {
  readAhead(16);
  int x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
char rch() {
  readAhead(16);
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  char ans = *stdinPos;
  ++stdinPos;
  return ans;
}
long long rlong() {
  readAhead(32);
  long long x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}