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;
using namespace rel_ops;
using ll = int64_t;
using Pii = pair<int, int>;
using ull = uint64_t;
using Vi = vector<int>;
void run();
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  run();
  return 0;
}
int uplg(int n) { return 32 - __builtin_clz(n); }
int uplg(ll n) { return 64 - __builtin_clzll(n); }
struct ABString {
  Vi parts;
  bool front;
  ;
  void push(int count, bool type) {
    if (count == 0) return;
    if (parts.empty() || front != type) {
      parts.push_back(0);
      front = type;
    }
    parts.back() += count;
  }
  pair<int, bool> pop() {
    if (parts.empty()) return {0, 0};
    pair<int, bool> ret = {parts.back(), front};
    parts.pop_back();
    front = !front;
    return ret;
  }
  void read() {
    string tmp;
    cin >> tmp;
    parts.clear();
    for (int i = int((tmp).size()) - 1; i >= 0; i--) push(1, tmp[i] == 'b');
  }
  bool satisfied() { return int((parts).size()) <= 1; }
};
struct State {
  ABString s, t;
  vector<Pii> ans;
  ;
  void makeMove(int a, int b) {
    vector<pair<int, bool>> first, second;
    Pii move = {0, 0};
    for (int i = (0); i < (a); i++) {
      first.push_back(s.pop());
      move.first += first.back().first;
    }
    for (int i = (0); i < (b); i++) {
      second.push_back(t.pop());
      move.second += second.back().first;
    }
    reverse((first).begin(), (first).end());
    reverse((second).begin(), (second).end());
    for (auto &e : (first)) t.push(e.first, e.second);
    for (auto &e : (second)) s.push(e.first, e.second);
    if (move.first != 0 || move.second != 0) {
      ans.push_back(move);
    }
  }
  void greedy() {
    if (s.front == t.front) {
      if (int((s.parts).size()) > int((t.parts).size())) {
        makeMove(1, 0);
      } else {
        makeMove(0, 1);
      }
    }
    while (!s.satisfied() || !t.satisfied()) {
      makeMove(1, 1);
    }
  }
  void solve() {
    bool swapped = false;
    if (int((s.parts).size()) < int((t.parts).size())) {
      swap(s, t);
      swapped = true;
    }
    int mid = (int((s.parts).size()) - int((t.parts).size())) / 2;
    State best;
    bool found = false;
    for (int a = (max(mid - 3, 0)); a < (min(mid + 4, int((s.parts).size())));
         a++) {
      for (int b = (0); b < (2); b++) {
        State alt = *this;
        alt.makeMove(a, b);
        if (!alt.s.satisfied() || !alt.t.satisfied()) {
          alt.greedy();
        }
        if (!found || int((alt.ans).size()) < int((best.ans).size())) {
          best = move(alt);
          found = true;
        }
      }
    }
    *this = move(best);
    if (swapped)
      for (auto &first : (ans)) swap(first.first, first.second);
  }
};
void run() {
  State state;
  state.s.read();
  state.t.read();
  state.solve();
  cout << int((state.ans).size()) << '\n';
  for (auto &first : (state.ans))
    cout << first.first << ' ' << first.second << '\n';
}