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;
inline int read() {
  int x = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * neg;
}
inline int qpow(int x, int e, int _MOD) {
  int ans = 1;
  while (e) {
    if (e & 1) ans = ans * x % _MOD;
    x = x * x % _MOD;
    e >>= 1;
  }
  return ans;
}
char sa[200005], sb[200005];
vector<pair<int, int> > a, b;
inline void push(vector<pair<int, int> > &v, pair<int, int> add) {
  if (v.empty())
    v.push_back(add);
  else {
    if (v.back().first == add.first)
      v.back().second += add.second;
    else
      v.push_back(add);
  }
}
bool swp = 0;
vector<pair<int, int> > ans;
inline void deal(int len) {
  pair<int, int> bk = b.back();
  b.pop_back();
  int sum = 0;
  for (int i = len; i >= 1; i--)
    push(b, a[a.size() - i]), sum += a[a.size() - i].second;
  for (int i = len; i >= 1; i--) a.pop_back();
  ans.push_back({sum, bk.second});
  push(a, bk);
}
signed main() {
  cin >> sa + 1 >> sb + 1;
  int la = strlen(sa + 1), lb = strlen(sb + 1);
  for (int i = la; i >= 1; i--) push(a, {sa[i] - 'a', 1});
  for (int i = lb; i >= 1; i--) push(b, {sb[i] - 'a', 1});
  if (a.size() < b.size()) swap(a, b), swp = 1;
  if (a.back().first == b.back().first) {
    if ((a.size() - b.size()) % 4 == 3) deal((a.size() - b.size() + 1) / 4 * 2);
    b.push_back({((b.back().first == 0) ? (1) : (0)), 0});
    deal((a.size() - b.size() + 1) / 4 * 2 + 1);
  } else {
    if (a.size() - b.size() > 2) deal((a.size() - b.size() + 1) / 4 * 2 + 1);
  }
  while (a.size() > 1 || b.size() > 1) {
    deal(1);
  }
  cout << ans.size() << endl;
  for (__typeof(ans.begin()) it = ans.begin(); it != ans.end(); it++) {
    if (swp)
      cout << (it->second) << " " << (it->first) << endl;
    else
      cout << (it->first) << " " << (it->second) << endl;
  }
  return 0;
}