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;
void genV(string s, vector<pair<char, int>>& v) {
  for (int i = 0; i < (((int)(s).size())); i++) {
    if (v.empty() || v.back().first != s[i])
      v.push_back(make_pair(s[i], 1));
    else
      v.back().second++;
  }
}
void push_front(vector<pair<char, int>>& v, pair<char, int> p) {
  reverse((v).begin(), (v).end());
  v.push_back(p);
  reverse((v).begin(), (v).end());
}
void pop_front(vector<pair<char, int>>& v) {
  reverse((v).begin(), (v).end());
  v.pop_back();
  reverse((v).begin(), (v).end());
}
void swap_pref(vector<pair<char, int>>& v1, vector<pair<char, int>>& v2,
               int amt1, int amt2) {
  reverse((v1).begin(), (v1).end());
  reverse((v2).begin(), (v2).end());
  vector<pair<char, int>> tmp;
  for (int i = 0; i < (amt1); i++) {
    tmp.push_back(v1.back());
    v1.pop_back();
  }
  assert(amt2 <= 1);
  for (int i = 0; i < (amt2); i++) {
    if (v1.back().first == v2.back().first)
      v1.back().second += v2.back().second;
    else
      v1.push_back(v2.back());
    v2.pop_back();
  }
  for (int i = 0; i < (amt1); i++) {
    if (v2.back().first == tmp.back().first)
      v2.back().second += tmp.back().second;
    else
      v2.push_back(tmp.back());
    tmp.pop_back();
  }
  reverse((v1).begin(), (v1).end());
  reverse((v2).begin(), (v2).end());
}
vector<pair<int, int>> solve(vector<pair<char, int>> v1,
                             vector<pair<char, int>> v2) {
  if (((int)(v2).size()) > ((int)(v1).size())) {
    vector<pair<int, int>> res = solve(v2, v1);
    for (int i = 0; i < (((int)(res).size())); i++)
      swap(res[i].first, res[i].second);
    return res;
  }
  if (v1.back().first == v2.back().first) {
    v1.push_back(make_pair('a' + 'b' - v1.back().first, 0));
    vector<pair<int, int>> r1 = solve(v1, v2);
    v1.pop_back();
    v2.push_back(make_pair('a' + 'b' - v1.back().first, 0));
    vector<pair<int, int>> r2 = solve(v1, v2);
    if (((int)(r1).size()) < ((int)(r2).size()))
      return r1;
    else
      return r2;
  }
  vector<pair<int, int>> res(1, make_pair(-1, -1));
  int best = INT_MAX;
  pair<int, int> m1;
  int pref1 = 0, pref2 = 0;
  for (int i = 0; i < (((int)(v1).size()) + 1); i++) {
    pref2 = 0;
    for (int j = 0; j < (2); j++) {
      int moves1 =
          max(((int)(v1).size()) - i - 1, 0) + max(j - 1, 0) +
          (i < ((int)(v1).size()) && j > 0 && v1[i].first != v2[j - 1].first);
      int moves2 =
          max(((int)(v2).size()) - j - 1, 0) + max(i - 1, 0) +
          (i > 0 && j < ((int)(v2).size()) && v1[i - 1].first != v2[j].first);
      int nummoves = max(moves2, moves1);
      if ((i < ((int)(v1).size()) || j > 0) &&
          (j < ((int)(v2).size()) || i > 0)) {
        char c1 = (j > 0) ? v2[0].first : v1[i].first;
        char c2 = (i > 0) ? v1[0].first : v2[j].first;
        if (c1 == c2 && moves1 == moves2) nummoves++;
      }
      if (nummoves < best) {
        best = max(moves2, moves1);
        m1 = make_pair(i, j);
        res[0] = make_pair(pref1, pref2);
      }
      if (j < ((int)(v2).size())) pref2 += v2[j].second;
    }
    if (i < ((int)(v1).size())) pref1 += v1[i].second;
  }
  swap_pref(v1, v2, m1.first, m1.second);
  if (!v1.empty() && !v2.empty() && v1[0].first == v2[0].first) {
    res.push_back(make_pair(v1[0].second, 0));
    v2[0].second += v1[0].second;
    pop_front(v1);
  }
  pref1 = 0, pref2 = 0;
  for (int i = 0; i < (max(((int)(v1).size()) - 1, ((int)(v2).size()) - 1));
       i++) {
    if (i < ((int)(v1).size())) pref1 += v1[i].second;
    if (i < ((int)(v2).size())) pref2 += v2[i].second;
    res.push_back(make_pair(pref1, pref2));
    swap(pref1, pref2);
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  vector<pair<char, int>> v1, v2;
  genV(s, v1);
  genV(t, v2);
  if (((int)(v1).size()) == 1 && ((int)(v2).size()) == 1 &&
      v1[0].first != v2[0].first) {
    cout << 0 << endl;
    return 0;
  }
  vector<pair<int, int>> res = solve(v1, v2);
  cout << ((int)(res).size()) << "\n";
  for (int i = 0; i < (((int)(res).size())); i++)
    cout << res[i].first << " " << res[i].second << "\n";
}