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 <class T>
using vv = vector<vector<T>>;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
  os << "{";
  for (int(i) = 0; (i) < (t.size()); ++(i)) {
    os << t[i] << ",";
  }
  os << "}" << endl;
  return os;
}
template <class T, size_t n>
ostream &operator<<(ostream &os, const array<T, n> &t) {
  os << "{";
  for (int(i) = 0; (i) < (n); ++(i)) {
    os << t[i] << ",";
  }
  os << "}" << endl;
  return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
  return os << "(" << t.first << "," << t.second << ")";
}
template <class S, class T, class U>
ostream &operator<<(ostream &os, const tuple<S, T, U> &t) {
  return os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ")";
}
template <class S, class T, class U, class V>
ostream &operator<<(ostream &os, const tuple<S, T, U, V> &t) {
  return os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ","
            << get<3>(t) << ")";
}
template <class S, class T, class U, class V, class W>
ostream &operator<<(ostream &os, const tuple<S, T, U, V, W> &t) {
  return os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ","
            << get<3>(t) << "," << get<4>(t) << ")";
}
template <class T>
inline bool MX(T &l, const T &r) {
  return l < r ? l = r, 1 : 0;
}
template <class T>
inline bool MN(T &l, const T &r) {
  return l > r ? l = r, 1 : 0;
}
const long long MOD = 1e9 + 7;
int solve0(const string &s, const string &t, vector<pair<int, int>> &re,
           int inv = 0) {
  vector<int> a, b;
  auto fun = [&](const string &s, vector<int> &re, int t) {
    int n = s.size();
    for (int i = 0; i < n; t = 1 - t) {
      re.push_back(0);
      while (i < n && s[i] % 2 == t) ++re.back(), ++i;
    }
  };
  fun(s, a, inv);
  fun(t, b, 1 - inv);
  int N = a.size();
  int M = b.size();
  int mn = max(N, M) - 1;
  int cut = 0;
  for (int(i) = 0; (i) < (M); ++(i)) {
    int n = 0, m = 1;
    if ((i + 1) % 2) {
      n += i + 1;
    } else if (b[0] == 0) {
      n += i;
    } else {
      n += 1 + i + 1;
    }
    m += M - (i + 1 + 1);
    if (!n) n = 1;
    n += N - (i + 1) % 2 - 1;
    if (MN(mn, max(n, m))) {
      cut = i + 1;
    }
  }
  assert(cut < M);
  if (cut) {
    int sum = 0;
    for (int(i) = 0; (i) < (cut); ++(i)) sum += b[i];
    re.emplace_back(cut % 2 ? a[0] : 0, sum);
    vector<int> A, B{(cut % 2 ? a[0] : 0)};
    if (cut % 2) {
      for (int(i) = 0; (i) < (cut); ++(i)) A.push_back(b[i]);
    } else if (b[0] == 0) {
      for (int(i) = 1; (i) < (cut); ++(i)) A.push_back(b[i]);
    } else {
      A.push_back(0);
      for (int(i) = 0; (i) < (cut); ++(i)) A.push_back(b[i]);
    }
    B.back() += b[cut];
    for (int(i) = cut + 1; (i) < (M); ++(i)) B.push_back(b[i]);
    if (A.size() == 0) A.push_back(0);
    if (a.size() > cut % 2) A.back() += a[cut % 2];
    for (int(i) = cut % 2 + 1; (i) < (N); ++(i)) A.push_back(a[i]);
    a = A;
    b = B;
  }
  if (a.size() > b.size()) b.resize(a.size());
  if (b.size() > a.size()) a.resize(b.size());
  int n = a.size();
  int x = 0, y = 0;
  for (int(i) = 0; (i) < (n - 1); ++(i)) {
    x += a[i];
    y += b[i];
    re.emplace_back(x, y);
    swap(x, y);
  }
  return re.size();
}
int solve(string s, string t, vector<pair<int, int>> &re) {
  solve0(s, t, re);
  vector<pair<int, int>> re2;
  solve0(s, t, re2, 1);
  if (re.size() > re2.size()) re = re2;
  return re.size();
}
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(0);
  string s, t;
  cin >> s >> t;
  vector<pair<int, int>> re0, re1;
  solve(s, t, re0);
  solve(t, s, re1);
  for (pair<int, int> &p : re1) swap(p.first, p.second);
  if (re0.size() > re1.size()) re0 = re1;
  cout << re0.size() << endl;
  for (pair<int, int> p : re0) cout << p.first << " " << p.second << "\n";
  return 0;
}