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>
bool uin(T& a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T& a, T b) {
  return a < b ? (a = b, true) : false;
}
const int inf = 2e9;
string a, b;
vector<int> l1, l2;
int get_cnt(const string& s) {
  for (int i = 0; i < (int)((int)(s).size()); ++i)
    if (s[i] != s[0]) return i;
  return (int)(s).size();
}
void op(int c1, int c2) {
  l1.push_back(c1);
  l2.push_back(c2);
  string ra = a.substr(0, c1), rb = b.substr(0, c2);
  a = rb + a.substr(c1);
  b = ra + b.substr(c2);
}
deque<int> getv(const string& s) {
  deque<int> ret;
  for (int i = 0; i < (int)(s).size();) {
    int pos = i;
    while (pos < (int)(s).size() && s[pos] == s[i]) pos++;
    ret.push_back(pos - i);
    i = pos;
  }
  return ret;
}
int solve() {
  int s1 = 0, s2 = 0;
  deque<int> v1 = getv(a), v2 = getv(b);
  bool flg = 1;
  int it = 0;
  while (1) {
    int c1 = v1.front(), c2 = v2.front();
    if ((int)(v1).size() == 1 && (int)(v2).size() == 1) break;
    if (flg && (int)(a).size() && (int)(b).size() && a[0] == b[0]) {
      l1.push_back(c1);
      l2.push_back(0);
      v1.pop_front();
      s2 += c1;
    } else {
      l1.push_back(s1 + c1);
      l2.push_back(s2 + c2);
      v1.pop_front();
      v2.pop_front();
      if (v1.empty()) v1.push_back(0);
      if (v2.empty()) v2.push_back(0);
      swap(s1, s2);
      s1 += c2;
      s2 += c1;
    }
    flg = 0;
  }
  return (int)(l1).size();
}
int get_l(const string& s, int num) {
  if (num == 0) return 0;
  int ret = 0;
  for (int i = 0; i < (int)(s).size();) {
    int pos = i;
    while (s[pos] == s[i]) pos++;
    i = pos;
    ret++;
    if (ret == num) return pos;
  }
}
void first_op(int c1, int c2) { op(get_l(a, c1), get_l(b, c2)); }
int sol(const string& s) {
  int ret = 0;
  for (int i = 0; i < (int)(s).size();) {
    int pos = i;
    while (pos < (int)(s).size() && s[pos] == s[i]) pos++;
    i = pos;
    ret++;
  }
  return ret;
}
int main(int argc, char** argv) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> a >> b;
  bool inv = 0;
  int c1 = sol(a), c2 = sol(b);
  if (c1 < c2) {
    swap(a, b);
    swap(c1, c2);
    inv = 1;
  }
  if (a[0] == b[0]) {
    int len = 0;
    while (1) {
      if (len == 0) {
        len = 1;
        c1--;
      } else {
        len += 2;
        c1 -= 2;
        c2 += 2;
      }
      if (c1 <= c2 + 1) break;
    }
    int len2 = 0;
    if (c1 + 2 == c2) {
      len--;
      len2++;
    }
    first_op(len, len2);
  } else if (c1 > c2 + 2) {
    int sum = (c1 + c2 - 2) / 2;
    if (c1 % 2 != c2 % 2) {
      if ((c1 - c2) % 4 == 1)
        first_op(c1 - sum - 1, 1);
      else
        first_op(c1 - sum, 1);
    } else
      first_op(c1 - sum, 1);
  }
  solve();
  cout << (int)(l1).size() << '\n';
  for (int i = 0; i < (int)((int)(l1).size()); ++i) {
    if (inv) swap(l1[i], l2[i]);
    cout << l1[i] << ' ' << l2[i] << '\n';
  }
}