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;
struct run_t {
  int n;
  char c;
  bool operator<(const run_t &o) const {
    if (n != o.n) return n < o.n;
    return c < o.c;
  }
};
string read_string() {
  char *str;
  scanf("%ms", &str);
  string result(str);
  free(str);
  return result;
}
deque<run_t> read() {
  deque<run_t> result;
  for (char c : read_string()) {
    if (!result.empty() && result.back().c == c)
      ++result.back().n;
    else
      result.push_back({1, c});
  }
  return result;
}
pair<vector<run_t>, vector<run_t>> apply(vector<run_t> a, vector<run_t> b,
                                         int na, int nb) {
  vector<run_t> pa(a.begin(), a.begin() + na);
  a.erase(a.begin(), a.begin() + na);
  vector<run_t> pb(b.begin(), b.begin() + nb);
  b.erase(b.begin(), b.begin() + nb);
  swap(pa, pb);
  if (!pa.empty() && !a.empty() && pa.back().c == a[0].c) {
    a[0].n += pa.back().n;
    pa.pop_back();
  }
  a.insert(a.begin(), pa.begin(), pa.end());
  if (!pb.empty() && !b.empty() && pb.back().c == b[0].c) {
    b[0].n += pb.back().n;
    pb.pop_back();
  }
  b.insert(b.begin(), pb.begin(), pb.end());
  return {a, b};
}
set<tuple<vector<run_t>, vector<run_t>, int>> vis;
vector<pair<int, int>> solve(vector<run_t> a, vector<run_t> b, int nop) {
  if (vis.find(make_tuple(a, b, nop)) != vis.end()) return {};
  vis.emplace(a, b, nop);
  if (nop == 0) {
    if (a.size() == 1 && b.size() == 1)
      return {{-1, -1}};
    else
      return {};
  } else {
    for (int na = 0; na <= (int)a.size(); ++na)
      for (int nb = 0; nb <= (int)b.size(); ++nb) {
        if (na == 0 && nb == 0) continue;
        if (na == (int)a.size() && nb == (int)b.size()) continue;
        vector<run_t> a2, b2;
        tie(a2, b2) = apply(a, b, na, nb);
        vector<pair<int, int>> res = solve(a2, b2, nop - 1);
        if (!res.empty()) {
          int size_a = 0, size_b = 0;
          for (int i = 0; i < na; ++i) size_a += a[i].n;
          for (int i = 0; i < nb; ++i) size_b += b[i].n;
          res.emplace_back(size_a, size_b);
          return res;
        }
      }
    return {};
  }
}
int main() {
  deque<run_t> a = read(), b = read();
  vector<pair<int, int>> result;
  bool flip = false;
  auto operate = [&](int na, int nb) {
    int tot_size_a = 0, tot_size_b = 0;
    for (int i = 0; i < na; ++i) tot_size_a += a[i].n;
    for (int i = 0; i < nb; ++i) tot_size_b += b[i].n;
    if (!flip)
      result.emplace_back(tot_size_a, tot_size_b);
    else
      result.emplace_back(tot_size_b, tot_size_a);
    deque<run_t> pa(a.begin(), a.begin() + na);
    for (int i = 0; i < na; ++i) a.pop_front();
    deque<run_t> pb(b.begin(), b.begin() + nb);
    for (int i = 0; i < nb; ++i) b.pop_front();
    swap(pa, pb);
    if (!pa.empty() && !a.empty() && pa.back().c == a.front().c) {
      a.front().n += pa.back().n;
      pa.pop_back();
    }
    for (int i = (int)pa.size() - 1; i >= 0; --i) a.push_front(pa[i]);
    if (!pb.empty() && !b.empty() && pb.back().c == b.front().c) {
      b.front().n += pb.back().n;
      pb.pop_back();
    }
    for (int i = (int)pb.size() - 1; i >= 0; --i) b.push_front(pb[i]);
  };
  while ((int)a.size() > 6 || (int)b.size() > 6 ||
         min((int)a.size(), (int)b.size()) >= 5) {
    if (a.size() > b.size()) {
      swap(a, b);
      flip = !flip;
    }
    if ((int)a.size() > 6) {
      if (a[0].c != b[0].c) {
        operate(1, 1);
      } else {
        operate(2, 1);
      }
    } else if (a.size() >= 2) {
      int with = (b.size() - 1) / 2;
      if (b[with].c == a[0].c) ++with;
      operate(1, with + 1);
    } else if (a.size() == 1) {
      int size = (b.size()) / 2;
      if (b[size - 1].c == a[0].c) ++size;
      if (size < (int)b.size())
        operate(1, size);
      else
        operate(0, (b[0].c == a[0].c ? 1 : 2));
    } else {
      int size = (b.size() - 1) / 2;
      if (size % 2 == 0) ++size;
      operate(0, size);
    }
  }
  if ((int)a.size() > 1 || (int)b.size() > 1) {
    if (flip) {
      swap(a, b);
      flip = false;
    }
    for (int nextra = 1;; ++nextra) {
      assert(nextra <= 100);
      vector<run_t> a2(a.begin(), a.end());
      vector<run_t> b2(b.begin(), b.end());
      vis.clear();
      vector<pair<int, int>> extra_res = solve(a2, b2, nextra);
      if (!extra_res.empty()) {
        reverse(extra_res.begin(), extra_res.end());
        extra_res.pop_back();
        result.insert(result.end(), extra_res.begin(), extra_res.end());
        break;
      }
    }
  }
  printf("%d\n", (int)result.size());
  for (pair<int, int> ab : result) printf("%d %d\n", ab.first, ab.second);
  return 0;
}