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;
char s[200200], t[200200], temps[200200], tempt[200200];
vector<pair<int, int> > ans, rlt;
int len[2][200200], sum[2][200200], tmp[2][30];
int dp[30][30];
pair<int, int> wa[30][30];
void solve(int n, int m) {
  rlt.clear();
  while (n >= 5 || m >= 5) {
    if (n >= 5) {
      if (m == 0) {
        m++;
        sum[1][m] = len[1][m] = 0;
      }
      rlt.push_back(pair<int, int>(sum[0][n - 2], sum[1][m]));
      rlt.push_back(
          pair<int, int>(sum[1][m] + len[0][n - 1] + len[0][n], sum[0][n - 3]));
      len[1][m] += len[0][n - 1], sum[1][m] += len[0][n - 1];
      n -= 4;
    } else {
      if (n == 0) {
        n++;
        sum[0][n] = len[0][n] = 0;
      }
      rlt.push_back(pair<int, int>(sum[0][n], sum[1][m - 2]));
      rlt.push_back(
          pair<int, int>(sum[1][m - 3], sum[0][n] + len[1][m - 1] + len[1][m]));
      len[0][n] += len[1][m - 1], sum[0][n] += len[1][m - 1];
      m -= 4;
    }
  }
  while (n || m) {
    int k = wa[n][m].first, l = wa[n][m].second;
    rlt.push_back(pair<int, int>(sum[0][k], sum[1][l]));
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 30; j++) tmp[i][j] = len[i][j];
    for (int i = 1; i <= k; i++) len[1][i] = tmp[0][i];
    for (int i = 1; i <= l; i++) len[0][i] = tmp[1][i];
    int a = (n - k) & 1;
    int b = (m - l) & 1;
    int x = n - k + l, y = m - l + k;
    for (int i = l + 1; i <= x; i++) len[0][i] = tmp[0][i - l + k];
    for (int i = k + 1; i <= y; i++) len[1][i] = tmp[1][i - k + l];
    if (a == b) {
      if (l) {
        x--, len[0][l] += tmp[0][k + 1];
        for (int i = l + 1; i <= x; i++) len[0][i] = tmp[0][i + 1 - l + k];
      }
      if (k) {
        y--, len[1][k] += tmp[1][l + 1];
        for (int i = k + 1; i <= y; i++) len[1][i] = tmp[1][i + 1 - k + l];
      }
    }
    for (int i = 1; i <= x; i++) sum[0][i] = sum[0][i - 1] + len[0][i];
    for (int i = 1; i <= y; i++) sum[1][i] = sum[1][i - 1] + len[1][i];
    n = x, m = y;
  }
}
int main() {
  memset(dp, 0x3f, sizeof dp);
  dp[0][0] = 0;
  for (int x = 0; x < 1000; x++) {
    for (int i = 0; i < 5; i++) {
      for (int j = 0; j < 5; j++) {
        if (i == 0 && j == 0) continue;
        for (int k = 0; k <= i; k++) {
          for (int l = 0; l <= j; l++) {
            if (k == 0 && l == 0) continue;
            int a = (i - k) & 1;
            int b = (j - l) & 1;
            int x = i - k + l, y = j - l + k;
            if (a == b) {
              if (l) x--;
              if (k) y--;
            }
            if (x < 5 && y < 5 && dp[i][j] > dp[x][y] + 1)
              dp[i][j] = dp[x][y] + 1, wa[i][j] = pair<int, int>(k, l);
          }
        }
      }
    }
  }
  scanf("%s %s", s + 1, t + 1);
  int n = strlen(s + 1), m = strlen(t + 1);
  vector<int> vec;
  vec.clear();
  for (int i = 1; i <= n; i++) {
    if (s[i] != s[i - 1]) vec.push_back(i - 1);
  }
  vec.push_back(n);
  int cn = vec.size() - 1;
  for (int i = 1; i <= cn; i++)
    len[0][i] = vec[i] - vec[i - 1], sum[0][i] = vec[i];
  vec.clear();
  for (int i = 1; i <= m; i++) {
    if (t[i] != t[i - 1]) vec.push_back(i - 1);
  }
  vec.push_back(m);
  int cm = vec.size() - 1;
  for (int i = 1; i <= cm; i++)
    len[1][i] = vec[i] - vec[i - 1], sum[1][i] = vec[i];
  if (s[n] == 'a') cn--;
  if (t[m] == 'b') cm--;
  solve(cn, cm);
  ans = rlt;
  vec.clear();
  for (int i = 1; i <= n; i++) {
    if (s[i] != s[i - 1]) vec.push_back(i - 1);
  }
  vec.push_back(n);
  cn = vec.size() - 1;
  for (int i = 1; i <= cn; i++)
    len[0][i] = vec[i] - vec[i - 1], sum[0][i] = vec[i];
  vec.clear();
  for (int i = 1; i <= m; i++) {
    if (t[i] != t[i - 1]) vec.push_back(i - 1);
  }
  vec.push_back(m);
  cm = vec.size() - 1;
  for (int i = 1; i <= cm; i++)
    len[1][i] = vec[i] - vec[i - 1], sum[1][i] = vec[i];
  if (s[n] == 'b') cn--;
  if (t[m] == 'a') cm--;
  solve(cn, cm);
  if (ans.size() > rlt.size()) ans = rlt;
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
}