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>
void inline chkMax(T &x, T y) {
  if (y > x) x = y;
}
template <typename T>
void inline chkMin(T &x, T y) {
  if (y < x) x = y;
}
template <typename T>
void inline read(T &x) {
  int f = 1;
  x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s <= '9' && s >= '0') x = x * 10 + (s ^ 48), s = getchar();
  x *= f;
}
template <typename T>
void print(T x) {
  if (x < 0) {
    putchar('-');
    print(x);
    return;
  }
  if (x >= 10) print(x / 10);
  putchar((x % 10) + '0');
}
const int N = 5e5 + 5, M = 1e6;
int n, m, f[N << 1], sz[N << 1], len, c[N << 1];
pair<int, int> ans[N];
char a[N], b[N];
int q1[N << 2], q2[N << 2], hh = 1 + M, tt = M, h = 1 + M, t = M;
int A[N << 2], B[N << 2], t1, t2;
int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }
void inline merge(int x, int y) {
  x = find(x), y = find(y);
  if (x == y) return;
  if (sz[x] > sz[y]) swap(x, y);
  f[x] = y, sz[y] += sz[x];
}
int sz1, sz2;
int inline calc1(int t) {
  return abs((sz1 + t - 2 + (sz1 == 0)) - (sz2 - t + ((sz2 - t) == 0)));
}
int inline calc2(int t) {
  return abs((sz2 + t - 2 + (sz2 == 0)) - (sz1 - t + ((sz1 - t) == 0)));
}
int inline calc3(int t) { return abs((sz1 + t - 1 + (sz1 == 0)) - (sz2 - t)); }
int inline calc4(int t) { return abs((sz2 + t - 1 + (sz2 == 0)) - (sz1 - t)); }
int main() {
  scanf("%s%s", a + 1, b + 1);
  n = strlen(a + 1), m = strlen(b + 1);
  for (int i = 1; i <= n + m; i++) {
    f[i] = i, sz[i] = 1;
    if (i <= n) {
      if (a[i] == 'b') c[i] = 1;
    } else {
      if (b[i - n] == 'b') c[i] = 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    int j = i;
    while (j < n && a[j + 1] == a[i]) j++, merge(j, i);
    q1[++tt] = i;
    i = j;
  }
  for (int i = 1; i <= m; i++) {
    int j = i;
    while (j < m && b[j + 1] == b[i]) j++, merge(n + j, n + i);
    q2[++t] = i + n;
    i = j;
  }
  int pok = 0;
  while (1) {
    sz1 = tt - hh + 1, sz2 = t - h + 1;
    if (sz1 == 1 && sz2 == 1) break;
    int cA = c[q1[hh]], cB = c[q2[h]];
    int u, v, o;
    if (cA == cB) {
      if (sz1 == 1) {
        u = 0, v = 1, o = calc3(v);
        while (v + 2 < sz2 && calc3(v + 2) < o) o = calc3(v + 2), v += 2;
      } else if (sz2 == 1) {
        u = 1, v = 0, o = calc4(u);
        while (u + 2 < sz1 && calc4(u + 2) < o) o = calc4(u + 2), u += 2;
      } else if (sz1 < sz2) {
        u = 1, v = 0, o = calc1(v);
        while (v + 2 < sz2 && calc1(v + 2) < o) o = calc1(v + 2), v += 2;
      } else {
        u = 0, v = 1, o = calc2(u);
        while (u + 2 < sz1 && calc2(u + 2) < o) o = calc2(u + 2), u += 2;
      }
    } else {
      if (sz1 < sz2) {
        u = 1, v = 1, o = calc1(v);
        while (v + 2 < sz2 && calc1(v + 2) < o) o = calc1(v + 2), v += 2;
      } else {
        u = 1, v = 1, o = calc2(u);
        while (u + 2 < sz1 && calc2(u + 2) < o) o = calc2(u + 2), u += 2;
      }
    }
    ++len;
    for (int i = hh; i < hh + u; i++) ans[len].first += sz[find(q1[i])];
    for (int i = h; i < h + v; i++) ans[len].second += sz[find(q2[i])];
    t1 = t2 = 0;
    for (int i = hh; i < hh + u; i++) A[++t1] = q1[i];
    for (int i = h; i < h + v; i++) B[++t2] = q2[i];
    hh += u, h += v;
    if (t2 && hh <= tt && c[q1[hh]] == c[B[t2]]) {
      merge(q1[hh], B[t2--]);
    }
    if (t1 && h <= t && c[q2[h]] == c[A[t1]]) {
      merge(q2[h], A[t1--]);
    }
    for (int i = t2; i; i--) q1[--hh] = B[i];
    for (int i = t1; i; i--) q2[--h] = A[i];
  }
  printf("%d\n", len);
  for (int i = 1; i <= len; i++) printf("%d %d\n", ans[i].first, ans[i].second);
}