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;
template <typename T>
vector<T>& operator--(vector<T>& v) {
  for (auto& i : v) --i;
  return v;
}
template <typename T>
vector<T>& operator++(vector<T>& v) {
  for (auto& i : v) ++i;
  return v;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& i : v) is >> i;
  return is;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (auto& i : v) os << i << ' ';
  return os;
}
template <typename T, typename U>
pair<T, U>& operator--(pair<T, U>& p) {
  --p.first;
  --p.second;
  return p;
}
template <typename T, typename U>
pair<T, U>& operator++(pair<T, U>& p) {
  ++p.first;
  ++p.second;
  return p;
}
template <typename T, typename U>
istream& operator>>(istream& is, pair<T, U>& p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& p) {
  os << p.first << ' ' << p.second;
  return os;
}
template <typename T, typename U>
pair<T, U> operator-(pair<T, U> a, pair<T, U> b) {
  return make_pair(a.first - b.first, a.second - b.second);
}
template <typename T, typename U>
pair<T, U> operator+(pair<T, U> a, pair<T, U> b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
template <typename T, typename U>
void umin(T& a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
void umax(T& a, U b) {
  if (a < b) a = b;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string a, b;
  cin >> a >> b;
  vector<pair<int, int>> result(2e6);
  auto upd = [&](vector<pair<int, int>> preans) {
    vector<pair<int, int>> best_ans;
    for (int ii = 0; ii < 2; ++ii) {
      vector<pair<int, int>> ans;
      a.push_back('a');
      b.push_back('b');
      int ia = a.size() - 2;
      int ib = b.size() - 2;
      string sa = "a";
      string sb = "b";
      while (ia >= 0 || ib >= 0) {
        while (ia >= 0 && a[ia] == a[ia + 1]) {
          sa.push_back(a[ia]);
          --ia;
        }
        while (ib >= 0 && b[ib] == b[ib + 1]) {
          sb.push_back(b[ib]);
          --ib;
        }
        if (ia < 0 && ib < 0) break;
        42;
        ans.emplace_back(ia, ib);
        swap(a, b);
        swap(ia, ib);
        if (ia >= 0) sa.push_back(a[ia]);
        if (ib >= 0) sb.push_back(b[ib]);
        if (ia >= 0) --ia;
        if (ib >= 0) --ib;
      }
      reverse(sa.begin(), sa.end());
      reverse(sb.begin(), sb.end());
      42;
      42;
      42;
      if (a.back() != 'a') swap(a, b);
      a.pop_back();
      b.pop_back();
      if (ii == 0 || ans.size() < best_ans.size()) {
        if (ii == 1) {
          for (int i = 0; i < ans.size(); ++i) {
            swap(ans[i].first, ans[i].second);
          }
        }
        swap(ans, best_ans);
      }
      swap(a, b);
    }
    for (auto x : best_ans) preans.push_back(x);
    if (result.size() > preans.size()) swap(preans, result);
  };
  upd({});
  vector<int> pa = {0}, push_back = {0};
  for (int i = 0; i + 1 < a.size(); ++i)
    if (a[i] != a[i + 1]) pa.push_back(i + 1);
  for (int i = 0; i + 1 < b.size(); ++i)
    if (b[i] != b[i + 1]) push_back.push_back(i + 1);
  pa.push_back(a.size());
  push_back.push_back(b.size());
  for (int ii = 0; ii < 2; ++ii) {
    int sa = pa.size();
    int sb = push_back.size();
    for (int i = (sa - sb) / 2 - 5; i < (sa - sb) / 2 + 5; ++i) {
      if (i < 0) continue;
      if (i >= pa.size()) continue;
      for (int j = 0; j < 5; ++j) {
        if (j >= push_back.size()) continue;
        42;
        42;
        string s;
        string t;
        vector<pair<int, int>> preans;
        if (pa[i] != 0 || push_back[j] != 0) {
          preans.emplace_back(pa[i] - 1, push_back[j] - 1);
          if (ii == 1) swap(preans.back().first, preans.back().second);
        }
        s = b.substr(0, push_back[j]) + a.substr(pa[i], a.size());
        t = a.substr(0, pa[i]) + b.substr(push_back[j], b.size());
        42;
        42;
        swap(s, a);
        swap(t, b);
        if (ii == 1) swap(a, b);
        upd(preans);
        if (ii == 1) swap(a, b);
        swap(s, a);
        swap(t, b);
      }
    }
    swap(a, b);
    swap(pa, push_back);
  }
  cout << result.size() << '\n';
  for (auto [a, b] : result) {
    cout << a + 1 << ' ' << b + 1 << '\n';
  }
  return 0;
}