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>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{ ";
  for (const T& t : v) os << t << ", ";
  return os << "}";
}
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& p) {
  return os << "{ " << p.first << ", " << p.second << " }";
}
const bool debug = 0;
struct Segment {
  char c;
  long long len;
};
deque<Segment> compress(string s) {
  deque<Segment> res;
  for (char c : s) {
    if (!(long long)(res).size() || res.back().c != c) {
      res.push_back(Segment({c, 0}));
    }
    ++res.back().len;
  }
  return res;
}
string decompress(deque<Segment> d) {
  string res;
  for (Segment s : d) {
    for (long long i = (0); i < (s.len); ++i) res.push_back(s.c);
  }
  return res;
}
vector<pair<long long, long long>> swaps;
void compute_ans(deque<Segment> r1, deque<Segment> r2) {
  while ((long long)(r1).size() > 1 || (long long)(r2).size() > 1) {
    if (r1.front().c == r2.front().c) {
      if ((long long)(r1).size() < (long long)(r2).size()) {
        swaps.push_back({0LL, r2.front().len});
        r1.front().len += r2.front().len;
        r2.pop_front();
      } else {
        swaps.push_back({r1.front().len, 0LL});
        r2.front().len += r1.front().len;
        r1.pop_front();
      }
    } else {
      swaps.push_back({r1.front().len, r2.front().len});
      Segment s1 = r1.front();
      r1.pop_front();
      Segment s2 = r2.front();
      r2.pop_front();
      r1.push_front(s2);
      r2.push_front(s1);
      if ((long long)(r1).size() > 1) {
        r1[1].len += r1.front().len;
        r1.pop_front();
      }
      if ((long long)(r2).size() > 1) {
        r2[1].len += r2.front().len;
        r2.pop_front();
      }
    }
  }
}
long long count_swaps(deque<Segment>& a, long long i, deque<Segment>& b,
                      long long j) {
  long long sa = i + (long long)(b).size() - j -
                 (j != (long long)(b).size() && b[j].c == a[i - 1].c);
  long long sb = j + (long long)(a).size() - i -
                 (i != (long long)(a).size() && j && a[i].c == b[j - 1].c);
  do {
    if (debug) cout << sa << ' ' << sb << endl;
  } while (false);
  return max(min(sa, sb) + (a[0].c == (j == 0 ? a[i].c : b[0].c)),
             max(sa, sb)) -
         1;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  deque<Segment> a = compress(s), b = compress(t);
  bool swp = false;
  if ((long long)(a).size() < (long long)(b).size()) {
    swap(a, b);
    swp = true;
  }
  do {
    if (debug)
      cout << "swp"
           << ": " << swp << endl;
  } while (false);
  long long best = 1e18;
  pair<long long, long long> par;
  for (long long end1 = (1); end1 < ((long long)(a).size() + 1); ++end1) {
    for (long long end2 = (max(0LL, (long long)(b).size() - 4));
         end2 < ((long long)(b).size() + 1); ++end2) {
      long long nc =
          count_swaps(a, end1, b, end2) +
          (end1 != (long long)(a).size() || end2 != (long long)(b).size());
      do {
        if (debug) cout << end1 << ' ' << end2 << ' ' << nc << endl;
      } while (false);
      if (nc < best) {
        best = nc;
        par = {end1, end2};
      }
    }
  }
  do {
    if (debug)
      cout << "best"
           << ": " << best << endl;
  } while (false);
  string na, nb;
  if (par != make_pair((long long)(a).size(), (long long)(b).size())) {
    pair<long long, long long> obj{0, 0};
    for (long long i = (0); i < (par.first); ++i) obj.first += a[i].len;
    for (long long i = (0); i < (par.second); ++i) obj.second += b[i].len;
    swaps.push_back(obj);
    string sa = decompress(a), sb = decompress(b);
    nb = sa.substr(0, obj.first) + sb.substr(obj.second);
    na = sb.substr(0, obj.second) + sa.substr(obj.first);
  } else {
    na = s;
    nb = t;
    swp = false;
  }
  do {
    if (debug)
      cout << "na"
           << ": " << na << endl;
  } while (false);
  do {
    if (debug)
      cout << "nb"
           << ": " << nb << endl;
  } while (false);
  compute_ans(compress(na), compress(nb));
  for (auto& p : swaps)
    if (swp) swap(p.first, p.second);
  cout << (long long)(swaps).size() << endl;
  for (auto p : swaps) cout << p.first << ' ' << p.second << '\n';
  return 0;
}