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 N = 500005;
struct atom {
  char c;
  int len;
};
char c[N];
vector<atom> a, b;
vector<pair<int, int> > ans;
int i, j;
void work(vector<atom> a, vector<atom> b) {
  for (;;) {
    if (a.size() == 1 && b.size() == 1 && a[0].c != b[0].c) break;
    if (a.back().c == b.back().c) {
      int sa = a.size(), sb = b.size();
      if (sb == 1) {
        ans.push_back(make_pair(a.back().len, 0));
        b.push_back(a.back());
        a.pop_back();
      } else if (sa == 1) {
        ans.push_back(make_pair(0, b.back().len));
        a.push_back(b.back());
        b.pop_back();
      } else {
        auto opt = [&](vector<atom>& a, vector<atom>& b, int sa, int sb) {
          atom x = a[sa - 1], y = a[sa - 2], z = b[sb - 1];
          ans.push_back({x.len + y.len, z.len});
          a.pop_back();
          a.pop_back();
          b.pop_back();
          a.push_back(z);
          b.back().len += y.len;
          b.push_back(x);
        };
        if (sa > sb)
          opt(a, b, sa, sb);
        else
          opt(b, a, sb, sa), swap(ans.back().first, ans.back().second);
      }
    } else {
      ans.push_back(make_pair(a.back().len, b.back().len));
      swap(a.back(), b.back());
    }
    while (a.size() > 1 && a.back().c == a[a.size() - 2].c) {
      a[a.size() - 2].len += a.back().len;
      a.pop_back();
    }
    while (b.size() > 1 && b.back().c == b[b.size() - 2].c) {
      b[b.size() - 2].len += b.back().len;
      b.pop_back();
    }
  }
}
int main() {
  scanf("%s", c + 1);
  for (i = 1; c[i]; ++i) {
    if (c[i] != c[i - 1])
      a.push_back((atom){c[i], 1});
    else
      ++a.back().len;
  }
  scanf("%s", c + 1);
  for (i = 1; c[i]; ++i) {
    if (c[i] != c[i - 1])
      b.push_back((atom){c[i], 1});
    else
      ++b.back().len;
  }
  auto calcw = [&](int sa, int sb, int ca, int cb) {
    if (sa < sb) swap(sa, sb);
    return sb == 1    ? sa == 1 && ca == cb ? 1 : sa - 1
           : ca != cb ? sa - 1
                      : sb + (sa - sb >> 1);
  };
  int x = 0, y = 0, sa = a.size(), sb = b.size(),
      mn = calcw(sa, sb, a[0].c, b[0].c);
  vector<int> va, vb;
  for (i = 0; i < min(sa, 5); ++i) va.push_back(i), va.push_back(sa - i);
  for (i = 0; i < min(sb, 5); ++i) vb.push_back(i), vb.push_back(sb - i);
  for (i = max(0, (sa + sb) / 2 - 5); i <= min(max(sa, sb), (sa + sb) / 2 + 5);
       ++i)
    if (sa > sb)
      va.push_back(i);
    else
      vb.push_back(i);
  auto unq = [&](vector<int>& v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
  };
  unq(va);
  unq(vb);
  for (int i : va)
    for (int j : vb) {
      int nsa, nsb, nca, ncb, ww;
      nsa = sa - i + j;
      nsb = sb - j + i;
      nca = j ? b[0].c : i == a.size() ? -1 : a[i].c;
      ncb = i ? a[0].c : j == b.size() ? -1 : b[j].c;
      if (j && i < a.size()) nsa -= b[j - 1].c == a[i].c;
      if (i && j < b.size()) nsb -= a[i - 1].c == b[j].c;
      ww = calcw(nsa, nsb, nca, ncb) + 1;
      if (ww < mn) mn = ww, x = i, y = j;
    }
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  if (x || y) {
    vector<atom> aa(a.begin() + a.size() - x, a.end()),
        bb(b.begin() + b.size() - y, b.end());
    a.resize(a.size() - x);
    b.resize(b.size() - y);
    int sa = 0, sb = 0;
    for (auto u : aa) sa += u.len;
    for (auto u : bb) sb += u.len;
    ans.push_back({sa, sb});
    auto doo = [&](vector<atom>& a, vector<atom>& z) {
      if (!z.empty() && z[0].c == a.back().c)
        a.back().len += z[0].len, z.erase(z.begin());
      a.insert(a.end(), z.begin(), z.end());
    };
    doo(a, bb);
    doo(b, aa);
  }
  work(a, b);
  printf("%d\n", int(ans.size()));
  for (i = 0; i < ans.size(); ++i)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}