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;
long long read() {
  long long x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - 48, ch = getchar();
  return x;
}
const int N = 1000005;
int c[N], v[N], Next[N], cnt_node = 0;
int L = 0, R = 1, len[2], head[2], n = 0, ans[N][2];
char s1[N], s2[N];
int new_node(int color, int tot, int nxt) {
  cnt_node++, c[cnt_node] = color, v[cnt_node] = tot, Next[cnt_node] = nxt;
  return cnt_node;
}
void build(int f, char s[]) {
  int n = strlen(s + 1), p = new_node(s[1] - 'a', 1, 0);
  head[f] = p, len[f] = 1;
  for (int i = 2; i <= n; i++)
    if (s[i] == s[i - 1])
      v[p]++;
    else
      p = Next[p] = new_node(s[i] - 'a', 1, 0), len[f]++;
}
int func0(int x, int a, int b) { return abs(a - 2 * x - 1 - (b + 2 * x)); }
int func1(int x, int a, int b) { return abs((a - 2 * x) - (b + 2 * x - 2)); }
int func2(int x, int a, int b) { return abs(a - 2 * x - 1 - (b + 2 * x - 1)); }
void Get_len() {
  len[L] = 0, len[R] = 0;
  for (int p = head[L]; p; p = Next[p]) len[L]++;
  for (int p = head[R]; p; p = Next[p]) len[R]++;
  if (len[L] < len[R]) swap(L, R);
}
int main() {
  scanf("%s%s", s1 + 1, s2 + 1);
  build(0, s1), build(1, s2);
  if (len[L] < len[R]) swap(L, R);
  while (len[L] > 1) {
    if (len[L] < len[R]) swap(L, R);
    if (c[head[L]] == c[head[R]]) {
      if (len[R] > 1 && len[L] > 2) {
        int a = len[L], b = len[R], x1 = (a - b + 2) / 4, x2 = x1 + 1;
        int x = func1(x1, a, b) <= func1(x2, a, b) ? x1 : x2;
        x = max(1, min(x, a / 2));
        int tot = v[head[L]], p = head[L];
        for (int i = 1; i <= x * 2 - 1; i++) p = Next[p], tot += v[p];
        n++, ans[n][L] = tot, ans[n][R] = v[head[R]];
        int hL = head[L], hR = head[R];
        v[head[L] = Next[p]] += v[hR];
        head[R] = hL, Next[p] = Next[Next[hR]], v[p] += v[Next[hR]];
        len[L] -= x * 2;
        len[R] += x * 2 - 2;
        if (len[L] < len[R]) swap(L, R);
        continue;
      }
      int a = len[L], b = len[R], x1 = (a - b - 1) / 4, x2 = x1 + 1;
      int x = func0(x1, a, b) <= func0(x2, a, b) ? x1 : x2;
      x = min(x, (a - 1) / 2);
      int tot = v[head[L]], p = head[L];
      for (int i = 1; i <= x * 2; i++) p = Next[p], tot += v[p];
      n++, ans[n][L] = tot, ans[n][R] = 0;
      int t = Next[p];
      Next[p] = head[R];
      head[R] = head[L];
      head[L] = t;
      v[p] += v[Next[p]];
      Next[p] = Next[Next[p]];
      Get_len();
    } else {
      int a = len[L], b = len[R], x1 = (a - b - 1) / 4, x2 = x1 + 1;
      int x = func2(x1, a, b) <= func2(x2, a, b) ? x1 : x2;
      x = min(x, (a - 1) / 2);
      int tot = v[head[L]], p = head[L];
      for (int i = 1; i <= x * 2; i++) p = Next[p], tot += v[p];
      n++, ans[n][L] = tot, ans[n][R] = v[head[R]];
      int hL = head[L], hR = head[R];
      head[R] = hL, head[L] = hR;
      v[head[L]] += v[Next[p]];
      v[p] += v[Next[hR]];
      int t = Next[Next[hR]];
      Next[head[L]] = Next[Next[p]];
      Next[p] = t;
      Get_len();
    }
    while (c[head[L]] != c[head[R]] && len[R] > 1) {
      int hL = head[L], hR = head[R];
      n++, ans[n][L] = v[hL], ans[n][R] = v[hR];
      head[L] = hR, head[R] = hL;
      v[hL] += v[Next[hR]];
      v[hR] += v[Next[hL]];
      int nhL = Next[Next[hL]], nhR = Next[Next[hR]];
      Next[hL] = nhR, Next[hR] = nhL;
      len[L]--, len[R]--;
    }
  }
  printf("%d\n", n);
  for (int i = 1; i <= n; i++) printf("%d %d\n", ans[i][0], ans[i][1]);
  return 0;
}